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 trialmelissakeith
3,766 PointsNeed help figuring out why no student data prints to page.
the prompt search works, and when I enter quit it exits the alert, but nothing happens when I search for students
2 Answers
Steven Parker
231,533 PointsIt worked fine for me.
I did notice that the search is case-sensitive, so if you enter "dave" it will not find anything.
But it finds "Dave" and displays the information.
melissakeith
3,766 PointsI made those changes and it works no if I type it in lowercase like this 'jody', but now it doesn't work when I enter it like I had to before 'Jody', very strange because I thought the whole point to .toLowerCase() was to be able to type in any case and have the information still math up.
melissakeith
3,766 PointsNevermind I went back and check my code, that worked I just hadn't made all the changes.
melissakeith
3,766 Pointsmelissakeith
3,766 PointsThat worked I didn't pay close enough attention to what he was doing in the video. Say I wanted to be able to enter the student's name in any case, I tried
search = prompt.toLowerCase('Enter a students name [Jody], or type "quit" to exit');
But this didn't work, any suggestions?
Steven Parker
231,533 PointsSteven Parker
231,533 PointsYou need to apply the conversion function after the prompt function, like this:
search = prompt('Enter a students name [Jody], or type "quit" to exit').toLowerCase();
And that's just half of process, you need to convert the name to lower case also so it will match:
if (student.name.toLowerCase() === search) {