30 of 33 Objects for?


#1

30 of 33
May I know what is wrong with this code?
Thanks in advance!
var spencer = {
age: 22,
country: "United States"
};

// make spencer2 here with constructor notation
var spencer2 = new Objects();
spencer2.age = 22;
spencer2.country = "United States";
console.log(spencer2);


#2

I feel bad replying (because I'm just learning JS myself), but in your last statement - console.log(spencer2); - it appears to me that you're not actually calling any property of the object. If I'm not mistaken, a proper call would look like:
console.log(spencer2.age);

where you can call any property of the object:
console.log(var.[property]);
will write in the output that specified property value.


#3

When I saw your explanation thru' email from codecademy, I realized my error. When I sat down to get thru' the lesson right now, I was able to get thru'
Thanks Jasart!


#4

Thanks! MAKE EACH DAY...Your Masterpiece Suman


#5

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