JavaScript Practice Object Basics in JavaScript Practicing Object Basics Practice Adding a Property on the Fly

Stephan Hoeksema
Stephan Hoeksema
15,933 Points

Why is this incorrect?

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

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