Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTrevon Allen
7,725 PointsYour countWords() method is not returning the correct number of words.
not sure why im getting this Bummer any assistance is appreciated
const myString = {
string:"Programming with Treehouse is fun!",
countWords: function () {
return this.string.length
}
}
1 Answer
Jonathan Hermansen
25,935 PointsYou should count the number of words in the string, not how long the string is. Hint: .split(" ")
Trevon Allen
7,725 Pointsahhh return this.string.split( ' ' ).length thank you that worked
mrsands
Courses Plus Student 13,641 Pointsmrsands
Courses Plus Student 13,641 PointsShe says "call a method" when she's really requesting us to create a function. This is a mistake on the instructor's behalf. This frustration had no educational value. Please correct this BS!