4. sayJob() does not properly log


#1

The output reads: "I work as a programmer" and "I work as a super programmer"

What am I doing wrong?

Code:

 var james = {
     job: "programmer",
    married: false,
     sayJob: function() {
         // complete this method
 console.log("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();

#2

Lol this is funny :laughing:

Your error is probably the most minor error in history of programming and that is it says to print

Hi, i work as a programmer 
Hi, i work as a super programmer

So just change this part of your code:

Your Code:

Correct Code:

console.log("Hi, I work as a " + this.job);

Hope this helped, again funny , and if there are any other problems please reply saying so and Good Luck!


#3

Do it have to show the statement on the console or not, because nothing appears


#4

Yes it does. Paste your code


#5

my code is:
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();

it says that everything is correct, but shows nothing.


#6

I have the same issue, nothing appears in console.

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();


#7

I had the same issue as you. I had the right code solution but it didn't print to the console. I suggest refreshing the browser and it should print:

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


4. Not printing to Console but code is right. Refresh Solution
#8

Oh, my goodness. You helped me complete the course. Thanks so much.


#9

That space between the a and " was brutal... I spent 20minutes trying to figure it out. Thank you!