1. An objective overview


#1

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 Person("Student",true);

I dont understand whats wrong in the above code....
It gives error as "Oops, try again.
Make sure you created gabby with the Person constructor and gave her a job of 'student' by passing it as the first argument.


#2

try the student with a small s


#3

my code is exacty the same as @mohith_kalyan (with a small "s" in "student"), but i still get a syntax error...

Oops, try again. There was a problem with your syntax.

just to remind:

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 Person("student", true);

where is the problem?


#4

in the Person function

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

replace the semicolon after programmer with a comma

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

#5

thanks it worked. :+1:

i owe you a pint of :beer:


#6

Glad I could help. Happy coding @arcsn
cheers
Eric


#7

This worked for me too:

var gabby = new Person();
gabby.job = 'student';
gabby.married = true;


#8

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 Person("student", true);

Try this


#9

Thank you! I cannot believe a semi-colon and comma separates correct from complete fail! Dangit