1/15 An Objective Review


#1

My code:

var james = {
// add properties to this object!
job: "programmer",
married: false
};

function Person(job, married) {
this.job = job;
this.married = married;
}

// create a "gabby" object using the Person constructor!
var gabby = new Object();
gabby.job = "student";
gabby.married = true;

The result: "Oops, try again. Make sure you created gabby using the Person constructor!"

What's wrong here? Thx.


#2

you should create a Person here, not an object


#3

Got it, thanks!
That works:

var gabby = new Person("student", true);


#4

This is the constructor:

Use it like this:

var gabby = new Person("student", true);

to create object of type Person.