Can I See Your References?


#1



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


Error message I am receiving:
Oops, try again. It looks like you did not change james.job to 'super programmer' on line 14.

Can someone explain what is wrong with my code?


var james = {
    job: "programmer",
    married: false,
    sayJob: function(job) {
       console.log("Hi, I work as a" + " " + this.job); // complete this method
        
    }
};

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

// change james' job to "super programmer" here
james.sayJob("super programmer");

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


#2

You need to change his job rather than call on the method sayJob. For example...

james.job = "super programmer";

Your way would work to print out that he is a super programmer, but your not actually changing his job title in the object. Thats why when you call sayJob a second time, it would repeat what his job was before, in this case being a "programmer" . Hope this helps!


#3

Thank you. The problem was solved :grin: