17. Using Object Literal Notation vs. Object Construction


I do not understand why my first attempt at creating an object using Object Literal Notation was correct yet when I attempted the same thing with Object Construction an error came up stating that I did not add any properties to myOwnObject.

var myOwnObject= {

//compare to

var myOwnObject= new Object();

Oops, try again. It looks like you didn't add any properties to myOwnObject!


name and age are properties of myOwnObject so need to be written as identifierNames.

myOwnObject.name = "Zoe";
myOwnObject.age = 23;


Thanks! I failed to notice that the different ways to make objects also included how to format the property names.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.