Introduction to Objects I
The Object Constructor

We mentioned the term constructor back in section one, when we talked about making an object using the keyword new. A constructor is a way to create an object.

When we write bob = new Object( ); we are using a built-in constructor called Object. This constructor is already defined by the JavaScript language and just makes an object with no properties or methods.

This means we have to add our properties one at a time, just like we've been doing. To review, we've created bob using the constructor and defined the name property for you.


Finish making bob by defining the age property and setting it equal to 20

Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Use line 3 to guide you in making the age property. Use bob.age instead of bob.name, and set it equal to 20.