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 Loops, Arrays and Objects Tracking Data Using Objects The Student Record Search Challenge Solution

What is wrong with my extra credit code, https://w.trhou.se/5fwygwjs7i? Thank you!

It prompts and then just spins!

1 Answer

Steven Parker
Steven Parker
231,268 Points

I notice these code issues:

  • the increment clause of the "for" loop is "i <= 1", you probably meant to write "i += 1"
  • to call "toLowerCase", it must have parentheses after the name (".toLowerCase()")
  • student names are stored in mixed case, so they cannot match a lower-cased string
  • the "print" is only being done in the "else" (for "not found")
  • each output is overwriting the previous one(s)
  • the "not found" determination should probably be done after the search loop