What Are Objects For? 30


#1

Please, help me. I got stuck in this task…

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

var spencer2 = newObject();
    spencer2.age= 23;
    spencer2.country= "United Kindom";
  
     function Person (age, country) {
         this.age = age;
         this.country = country;
     }
     var spencer2 = new Person(23, "United Kindom");
  // make spencer2 here with constructor notation

What’s wrong?


#2

so here:

var spencer2 = newObject();
spencer2.age= 23;
spencer2.country= "United Kindom";

you use the constructor notation as asked by the exercise, except new Object() should be two separate words, not sure why you also added a custom constructor:

     function Person (age, country) {
         this.age = age;
         this.country = country;
     }
     var spencer2 = new Person(23, "United Kindom");

it isn’t asked


#3

Thank you very much!!


#4