This forum is now read-only. Please use our new forums! Go to forums
It passed but there is SyntaxError: missing : after property id
Is this still right? This is 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 Person(){ job: “student”, married === true }
Answer 5260107bf10c605228000e6a
try this one
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);
Answer 51d2fae39c4e9d2adc00e4e3
var james = {
// add properties to this object!
job: "programmer",
married === false
};
I guess this line gives you the error message:
married === false
which means compare married to false. But what you should do is give james a property married like you did it for job and make this property equal to false:
var james = {
// add properties to this object!
job: "programmer",
married:false
};
And for the constructor:
function Person(job, married) {
this.job = job;
this.married = married;
}
well this.job and this.married are public properties of the later created object, which will get their values by the parameters of the function so if you create a new object via the constructor it goes like this:
var gabby = new Person("student", true)
in this case you just need to provide the parameters, no need to add an object literal.
Answer 52e9710e282ae3418a000b59
Answer 555a162e937676468e000303
The correct one
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() { gabby.job=”student”; gabby.married=true; }
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
Thanks