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

saul bard
saul bard
7,581 Points

I think i have it the same as the teacher but it doesnt show on the page even after i type quit?

https://w.trhou.se/y28gs7218u

have tried it with the print function inside and outside the while loop.

2 Answers

Kevin Gates
Kevin Gates
15,052 Points

Hi there, I think your issue is here:

for (var i = 0; i < students.length; i+= 1) {
        student = students [i];
      if (search.name === search.toLowerCase()) {
        message = getStudentReport ( student );
      }
}

I believe the if statement should compare student.name to search.toLowerCase()).

Steven Parker
Steven Parker
229,732 Points

The "search" term is a simple string, it has no "name" property. You probably meant to write "student" instead:

//    if (search.name === search.toLowerCase()) {     // original
      if (student.name === search.toLowerCase()) {    // fixed