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 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
14,855 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
216,083 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