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

James Viavattine
James Viavattine
4,926 Points

What am I doing wrong here?

code will not pass. Did I forget something?

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

1 Answer

There should be a comma after the first property

string: "Programming with Treehouse is fun!",