Arrays and Objects in JS- What do I doing wrong?



You should end it with semi-colons like below:

var object1 = new Object(); = "Spy";


I change to = "Spy";
SyntaxError: Unexpected token :


Not a colon (:)please. A semi-colon (;).

Please post full code.



var object1 = new Object(); = "Spy";
object1.age = 50;

And I get an output of:

{ name: 'Spy', age: 50 }

Please use above to replicate.


Thanks for your help.
One more thing when I type new object instead of new Object, it come out [ReferenceError: object is not defined], why need type (Object) capital.


JavaScript is case sensitive and so because it is written so, you have to also do as.


Thank you very much


You're welcome!

Have fun coding! :slight_smile: