It gives output but it gives error too


#1


Replace this line with your code.


#2

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

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

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

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


#3

Hello :slight_smile:

You have to know that tests are very strict.

There is a double space here:

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

First one is after the a and the second one is added. You only need one:

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

And [] around the job are not needed.


#4

ok, i made these changes but still gives me error

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


#5

Oh, ok, sorry about that.

You have created a method that takes job as an argument, but you were asked to use a job property:

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

#6

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