12 Practice Makes Perfect, Can't seem to pinpoint the problem with this ;/


var object1 = {
    name: "Alberto",
    age: 25

var object2 = {};
object2.name = "Alberto";
object2[age] = 25;

var object3 = new Object();
object3.name = "Alberto";
object3.age = 25;

It keeps saying 'Did you make object3 an object?'


That is strange...I ran your code, and I didn't get the same error.

Instead of Did you make object3 an object?, I'm getting:

Oops, try again. It looks like you have an error in your code! Check the error message for more details: ReferenceError: age is not defined

I've corrected the following line in your code, as it does have an undefined variable called age:

object2[age] = 25;


object2['age'] = 25;

If you recall from lesson 11, that is how you add keys to your object with the bracket notation. You need to have the key in quotation marks. After this correction, your code ran flawlessly on my end.


Oh god that was it haha, thanks!


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