JavaScript Practice Object Basics in JavaScript Practicing Object Basics Practice Adding a Method to an Object Literal

I have typed in the exact solution from the next step and I am receiving an "Unexpected Identifier" Error

I have typed in the exact solution from the next step and I am receiving an "Unexpected Identifier" Error

mystring.js
const myString = {
    string: "Programming with Treehouse is fun!"
  countWords: function (){
  const wordArray = this.string.split(' ');
  return wordArray.length;
}
}

1 Answer

Antony .
Antony .
2,801 Points

You need a comma after the string's property value.

string: "Programming with Treehouse is fun!",