30. IDK what i'm doing wrong... =[


#1

Would someone please tell me what I am doing wrong? It keeps saying,

"make sure you use the Object constructor."

Make a new object, spencer2, with the same properties but using constructor notation and the Object constructor.


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

make spencer2 here with constructor notation

function person(age, country) {
    this.age = age;
    this.country = country;
};

var spencer2 = new person(22, "United States");

#2

The Object constructor. You're using the person constructor.


#3

@netpro59119 just as @ionatan has mentioned you need to amend the code from literal notation to constructor notation

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

// lesson instruction
// Make a new object, spencer2, with the same properties but using constructor notation and the Object constructor.

// here is bob again, with his usual properties
// var bob = new Object();
// bob.name = "Bob Smith";
// bob.age = 30;

// make spencer2 here with constructor notation

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


#4

just to add..

I kept getting wrong even if I had the correct thing.
Then I just found out that the space between
"Object" AND "();" was the problem.

Hope it helps for some people like meh


#5

^Thank you so much -- greatly helped me.


#6

Oh.my.god THANK YOU!!!! I was about to throw my laptop out the window!!!! No joke I have been trying to figure out what the problem was for about an hour.