Fun with Functions


#1

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

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

..and the result is:
"Oops, try again. It looks like 'Hello!' wasn't logged to the console. Make sure that you properly defined the method and that you didn't change any of the provided code."

What's wrong?!


#2

Strange, after some refreshing code started to execute correctly.