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 trialkkellerman
15,633 PointsThe search.toLowerCase() function doesn't seem to work on Chrome. Only if type the name exactly as it's in the object.
Also I need to "quit" out of the program for it to post to the document.
3 Answers
KRIS NIKOLAISEN
54,971 PointsCan you post your code? Also see the teacher's notes for the video:
Important Update Since this video was shot, the behavior of most browsers has changed, so you won't see the same thing as I demonstrate in the video. In the video, you'll see that my script is able to print out to the browser using document.write( ) while inside a loop.
Most browsers no longer do that: they wait until the loop finishes and then they print to the window. So, you'll see a blank page until you type quit in the prompt window — then you'll see all the output printed to the screen.
Marc Sanchez
20,039 PointsWhat version of Chrome are you using? I'm using Version 76.0.3809.132
and it's working fine.
kkellerman
15,633 PointsVersion 76.0.3809.100
KRIS NIKOLAISEN
54,971 PointsThe only place you use toLowerCase() is in checking for 'quit'. If you also want to include the name search you could modify this line:
if ( student.name === search ) {
to this:
if ( student.name.toLowerCase() === search.toLowerCase()) {
Then the names could be typed in any case and would still be found.
kkellerman
15,633 PointsThanks, this was the issue for the case, but when I enter all names in the object, and then hit 'Quit' only one name is written to the page. Why is it doing that?
kkellerman
15,633 Pointskkellerman
15,633 Points