Parsing bug(?) on Chrome 54.0.2840.87 m (64-bit)


#1


So I've been doing recently "Can I see your References" exercise (https://www.codecademy.com/en/courses/objects-ii/0/4?curriculum_id=506324b3a7dffd00020bf661). And when I run this code:

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

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

> // change james' job to "super programmer" here
> james.job = "super programer";

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

That prints me a popup

Oops, try again. It looks like your sayJob() method does not properly log 'Hi, I work as a [job]' to the console

but when I try

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

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

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

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

Codeacademy parsing script accepts the code and moves me to next lesson, although console prints out an

ReferenceError: job is not defined

(as IMO it should) Who is wrong here, me or parsing script?


#2

But this.job is. Remember to include the context.


#3

Yes, in first post I've pasted the same code twice, thanks for reminder.


#5

remove the space from your code , it will work 100%


#6

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