30: What are Objects for?


#1

var spencer = {
age: 22,
country: "United States"
};

var spencer2 = new Object ();
spencer2.age = 22;
spencer2.country = "United States";
console.log(spencer2);

it's telling me I'm not using constructor notation and I am I'm so confused


#2

Hey @nbhavs! Just a simple fix! You have an unnecesary space between Object and ();

Here:

Do it like this:

var spencer2 = new Object();

Hope that helped!


#3

that solution worked thanks!


#4

No Problem @nbhavs! Any Time!


#5

I had this same problem and the same solution worked–but now I'm curious. Why does it matter whether or not I use an extra space?


#6

I console logged it and the object still worked I think it's just code academy messing up