Constructor Notation looks perfect to me. what's going on?


#1

"What Are Objects For?
Instructions
Make a new object, spencer2, with the same properties but using constructor notation and the Object constructor."

The first object was given. It's the literal notation form of the object spencer. I tried to make the object constructor to make spencer 2 but the response is always " Oops, try again. Make sure to use the Object constructor."

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

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

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

#2

Custom constructors come up in a little while. Not in this lesson though. We are to demonstrate that we know how to define an object using the Object constructor.

var object2 = new Object();

Use dot notation to define the properties.

object2.property = value;

#3

That worked for me; I was overthinking it. Thank you


#4

Thank you it has been very helpfull


#5

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