2/30 How is this not correct?


#1

function Person(job, married,speak) {
this.job = job;
this.married = married;
// add a "speak" method to Person!
this.speak = speak;
}

var user = new Person("Codecademy Student",false, "Hello!");
user.speak();

errors with:

Oops, try again. Make sure you added a speak method to the Person constructor


#2

You don't need to change any of the existing code. Here is what I have and it works:

function Person(job, married) {
this.job = job;
this.married = married;
// add a "speak" method to Person!
this.speak = function(speak){
console.log("Hello!");
};
}

var user = new Person("Codecademy Student",false);
user.speak();

Hope this helps!


#3

Actually, your "speak" function doesn't take any parameters. It works just as well like so:

this.speak = function() {
console.log("Hello");
};