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 trial

JavaScript JavaScript Foundations Strings Methods

Geoff Sharpe
Geoff Sharpe
4,854 Points

Challenge 2 does not work

I answer queston 1 correctly, but after I answer challenge 2, it says challenge one is wrong. I didn't change any of the answer so I'm unsure why this is the case. Here is the code I added below. The code that has supposedly been changed is quick.length:

 var quick = "The quick brown fox jumps over the lazy dog";

      var quickLength = quick.length;
      var indexOfBrown = quick.indexOf(brown);
      var tenthCharacter = quick;
      var wordBrown = quick;
      var quickUpper = quick;
      var quickLower = quick;

1 Answer

Alex Heil
Alex Heil
53,547 Points

hey geoff, this error message might be a little bit misleading, in fact from the code I can see here your task 1 still passes. however there's an error with the second task. you want to find the index of the "string" brown. now when you look at your code indexOf(brown) you're not treating the word brown as a string.

when strings are used they are wrapped in quotation marks, if you do so for the value brown then your code will pass this second task just fine ;)

Geoff Sharpe
Geoff Sharpe
4,854 Points

Thanks Alex! I thought it might be an issue with that (was hard to believe Treehouse was wrong!)