Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,534 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!)