Can I See Your References Problem


#1

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

Hi, it's Sai! I'm really confused; I keep running this code and comparing it to others' code on the same exercise, but for this code, the error message is "Oops, try again. It looks like you did not change james.job to 'super programmer' on line 14." I'm flummoxed; I did, it's right there, but maybe I have some syntax error or something. Could any of you please help me? Also, if I have any other errors in my code that I didn't pick up, it would be really nice if you guys could point them out too, because I'm still a novice at JavaScript and it can get really confusing.

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

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

// change james' job to "super programmer" here

james.sayJob("super programmer");

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

#2

sayJob() is a 'getter' function, not a 'setter'. Assign the new value directly to the james.job property.

james.job = ....

#3

It worked! Thanks so much :slight_smile:


#4

3 posts were split to a new topic: Why it isnt work?


#5