4/30 prints perfectly on the console, but still gives an error


#1

Hi,

So here's my 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.job = "super programmer";

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

And it prints out:

Hi, I work as a programmer
Hi, I work as a super programmer

But for some reason codecademy gives me the following error:

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

Can somebody please tell me what am I doing wrong?


#2

Hi - check what you're logging to the console - you missed the space after "a" and it doesn't need a comma.


#3

Hi,

Thanks for the fast reply! Could you specify where it doesn't need the comma? I also get two spaces on the console if I write a space after "a".


#4

In your sayJob method
console.log("Hi, I work as a", this.job);
should be
console.log("Hi, I work as a " + this.job);


#5

Now it works. Thank you!