I've passed but my code seems to be wrong... 4/30


#1

This is what I've typed:

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

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

// change james' job to "super programmer" here
this.job = "super programmer"

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

Here is what the interpreter said:

ReferenceError: newJob is not defined


#2

@f4te,

-1

As you use newJob, the interpreter is looking for a variable newJob
which you have NOT defined.

So either use a string Value
or
prior to defining the james object define a newJob variable

-2

Further on in your code your are referring to this.job
but you have to know that you are actually referring to the windows object...
and NOT the james object

google search
== the Book ==
javascript [your question] site:developer.mozilla.org

== discussions / opinions ==
javascript this explained site:stackoverflow.com
= http://stackoverflow.com/questions/3127429/how-does-the-this-keyword-work
== guidance ==
www.crockford.com
http://javascript.crockford.com/code.html
http://javascript.crockford.com/survey.html
https://developer.mozilla.org/en-US/docs/Web/JavaScript/A_re-introduction_to_JavaScript.