Fun with Functions


my task is as follows-
Add a speak method to the Person constructor. Whenever speak is called, it should print "Hello!" to the console.
and my code is

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

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


var speak = function(){ - here you declared speak as a private method. If you want to use it outside of Person you should declare it as a privileged method using this keyword.


its fixed . Thanks a lot.