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

my solution to the extra work he mentioned:

here is my code:

//Make Records searchable //Open Dialog box and request name of students //If theres a match print out the student data // If not not display a not found alert and ask again.

var message = ""; var results = 0;

while (true) { var search = prompt("Type Name Of Student:") search = search.toLowerCase();

if (search === null || search === "quit") { break; }

findName(search); if ( results > 0 ) { if (results < 2){ alert("We found " + results + " result!"); } else { alert("We found " + results + " results!"); } print(message); break; } else { alert("We found no results, Try again!"); }


function findName(input) { for (var i=0 ; i < students.length ; i++) { if (students[i].name.toLowerCase() === input) { for (var key in students[i]) { message += "<li>" + key + ": " + students[i][key] + "</li>"; } results++; } } }

function print(message) { document.getElementById("output").innerHTML = message; //the "output" is is the container where i want my files printed