4/30 can I see your references


#1

Can somebody please help me with this it says
"Oops, try again. It looks like your sayJob() method does not properly log 'Hi, I work as a [job]' to the console"
even though I had made so that the outcome says
"Hi, I work as a programmer
Hi, I work as a super programmer"

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

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

// change james' job to "super programmer" here
jamesjob = "super Programmer"

// james' second job
james.sayJob("super programmer");


#2

At that part you aren't supposed to have it as function(job) you are supposed to have it as just function().

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

Before the + you are supposed to have it as + this.job

james.sayJob("programmer");

Take away the "programmer"

jamesjob

You forgot the period between james and job

james.sayJob("super programmer");

And take away "super programmer"

And the P in programmer should not be capitalized.

I hope that helped.


#3

I'm not sure why but it isn't working thanks for the help though.:slight_smile:


#4

Could you post your code now that you have fixed it?


#5

1- the method
sayJob: function() {
// as you can see there is no argument
//this.job refers to the property job of the instance
console.log("Hi, I work as a " +this.job)


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


#6

:slight_smile::slight_smile:


It wont put anything in the console, but it says "way to go!"
#7

thanks that worked out with the other code


#8

+legendsoftomorrow It is quite weird that i am getting the same error ( getting desired output too...) for below lines of code. i checked yours reply and hadn't got any irregularities here:

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


#9

7 posts were split to a new topic: Why does this work:


#10