I'm currently just trying to create an object using 'edit javascript' and subsequently printing it in the passage but it keeps returning the object as undefined.
In Javascript:
var playerLook = {name: "Project", surname: "Endermis"};
In Passage:
<<print $playerLook.name>>
Comments
Since you're attempting to use <<print>>, I'm going to assume that you're using some version of SugarCube.
When you use a var statement you're declaring a local JavaScript variable, not a story variable.
To declare/modify a story variable within JavaScript, you need to use the State.variables API. For example:
That said, unless you have a good reason to be declaring your story variables within the Story JavaScript, I'd suggest using the StoryInit special passage instead. For example: