SyntaxError: Unexpected identifier


Here is what I have

var bool = true;
Obj myObj = new Obj();

var myArray = [11, bool, "string", myObj()];

I keep getting the unexpected identifier error.


well Obj is not an identifier in this case for Obj myObj. instead var needs to be used to get myObj = new Obj(); also Object needs to be written out in every place you have Obj unless your using myObj. Hopefully that will help! :smiley:


that worked, thanks!


6 posts were split to a new topic: Having a problem with this one