4/30 Unexpected Identifier?


#1

Not sure where the issue is...

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


#2

There's supposed to be no parameters in your functions.... and also, how are you supposed to know what this is?!:stuck_out_tongue:

Just need an equal sign between those two, and we're done!:smiley:


#3

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

And further down, should look like this...

james.job = "super programmer";

#4

does this look closer to the solution? still isn't working.... (Unexpected Identifier)

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


#5

Hmmm..... tried refreshing?


#6

You have a semi-colon inside an object, after a property (the method) which is illegal. Try removing that.


#7

Got rid of the semi colon after my method and replaced it with a comma but still didn't work. Also tried refreshing it... "Unexpected Token }" error.


#8

Please repost your code in a new Reply, so the OP remains unchanged. Thank you.


#9

Sure/Thanks @mtf

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

#10

Edited.

```

before and after code samples preserves the formatting and makes reading a breeze, don't you think?


#11

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

#12

Wow I learned a lot from that one. Thanks for the help @mtf


#13

You're very welcome!