Can't change the job, why?


#1


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


"Oops, try again. It looks like you did not change james.job to 'super programmer' on line 14."


Replace this line with your code. 
var james = {
    job: "programmer",
    married: false,
    sayJob: function() {
        // complete this method
        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

You are yet to complete this method using this.

put

this.job = newJob;

just above console.log method.

Also, this

You want to change that property key job and not sayJob of the object and not call it. You should be using the equal to sign.

james.job = "super programmer";

I hope this resolves! :slight_smile:


#3

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

}

};

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

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

// james' second job
james.sayJob("Dish washer");

This works just fine in codecademy lab, in the browser too but not in the COURSE......
I don't understand why did you accesed the job property like this "james.job" if you created a method, I mean that's why the method is there right?


#4

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