4. Can I see your references? SyntaxError: Expected ')'



SyntaxError: Expected ')'

I've checked everything and compared to other people's code but I can't figure it out. As far as I can tell (and I have refreshed the page before as well) nothing's wrong.

So obviously it's something tiny that my untrained-as-of-yet's eye is not able to pick up or something.

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

// james' first job

// change james' job to "super programmer" here
james.job = "super programmer";

// james' second job


Hi @demtemblem,

Usually when you are coding you will be working with an editor that has a linter. A linter helps you find problems.

Go to https://repl.it/languages/javascript and paste your code in to see which line has the problem.

Let me know how you get on with that.


Okay turns out that changing the sayJob console.log part from what I have in my Original Post to this

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

fixes it. Why? Why can't the below work?

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

EDIT: nevermind...I forgot a +...untrained eye....lol. Thanks for the link to that linter thing tho that'll be helpful! :slight_smile:


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