Can I see your reference


#1

https://www.codecademy.com/courses/objects-ii/0/4?curriculum_id=506324b3a7dffd00020bf661

I a bit astonished, see my code after trying to get it correct I the console.log to + sayJob instead of job.
I get a pass but also an error... what is wrong here?
error:
ReferenceError: 'sayJob' is undefined

var james = {
    job: "programmer",
    married: false,
    sayJob: function(job){
    this.job = job;

        // complete this method
        console.log("Hi, I work as a " + sayJob);
        
    }
};

// james' first job
james.sayJob();

// change james' job to "super programmer" here
james.sayJob = 'Super programmer';


// james' second job
james.sayJob ();


#2

var james = {
    job: "programmer",
    married: false,
    sayJob: function() {

        // complete this method
        console.log("Hi, I work as a " + this.job); //this.job can also be james.job 
        
    }
};

As well as this;

james.sayJob = 'Super programmer';

Should just be:

james.job = "Super programmer";

#3

This line effectively wipes out the method and replaces it with a string.

james.sayJob = 'Super programmer';
james.sayJob();

TypeError: james.sayJob is not a function (paraphrased)


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.