Stuck on 30


#1

https://www.codecademy.com/courses/spencer-sandbox/5/1?curriculum_id=506324b3a7dffd00020bf661#

This error keeps popping up when i run my code and i cant figure out whats wrong with it.
Oops, try again. Make sure that spencer and spencer2 have the same value for country

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

// make spencer2 here with constructor notation
function Person(age, country){
    this.age = age;
    this.country = country;
};
var spencer3 = new Person(22, "United States");
var spencer2 = new Object();
spencer2.age = 22;
spencer.country = "United States";


#2

In doing so, you are not making spencer2 a member of the Person class.


#3

it wants me to use the default object constructor, not my custom one. when i use my custom object constructor it gives me this error. "Oops, try again. Make sure to use the Object constructor."


#4

I have the same problem! There is probably an error in the exercize code. Does anyone know how to deal with it?


#5

Your error is in the last line.

spencer.country;

should be

spencer2.country;



I've tried to use both Custom Constructor and Literal and it was return true

var spencer3 = new Person(22, "United States");
var spencer2 = new Object();
spencer2.age = 22;
spencer2.contry = "United States";

#6

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