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.

Lucia Brammer
1,327 PointsNot doing the endless loop or displaying information. Please help :)
//functions & variables var student; var searchBar;
function print(message) { var outputDiv = document.getElementById('output'); outputDiv.innerHTML = message; };
function getStudentReport(student) { var report = '<h2>Student: ' + student.name + '</h2>'; report += '<p>Track: ' + student.track + '</p>'; report += '<p>Points: ' + student.points + '</p>'; report += '<p>Achievements: ' + student.achievements + '</p>'; return report; };
// endless loop while (true) { searchBar = prompt("Please enter the name of a student"); if (searchBar === null ||searchBar.toUpperCase() === 'QUIT') { break; } for (var i = 0; i < students.length; i += 1); { student = students[i]; if (searchBar === student.name) { message = getStudentReport(student); print(message); }; }; };
2 Answers

KRIS NIKOLAISEN
54,664 PointsYou have a few semicolons after functions that shouldn't be there. I changed your code as follows:
var student; var searchBar; var message = ''
function print(message) { var outputDiv = document.getElementById('output'); outputDiv.innerHTML = message; }
function getStudentReport(student) { var report = '<h2>Student: ' + student.name + '</h2>'; report += '<p>Track: ' + student.track + '</p>'; report += '<p>Points: ' + student.points + '</p>'; report += '<p>Achievements: ' + student.achievements + '</p>'; return report; }
// endless loop
while (true) { searchBar = prompt("Please enter the name of a student");
if (searchBar === null || searchBar.toUpperCase() === 'QUIT')
{ break; }
for (var i = 0; i < students.length; i += 1)
{ student = students[i];
if (searchBar === student.name)
{ message = getStudentReport(student);
print(message); }
}
}
but I think you may be experiencing what is described in the teacher's notes:
Important Update Since this video was shot, the behavior of most browsers has changed, so you won't see the same thing as I demonstrate in the video. In the video, you'll see that my script is able to print out to the browser using document.write( ) while inside a loop.
Most browsers no longer do that: they wait until the loop finishes and then they print to the window. So, you'll see a blank page until you type quit in the prompt window — then you'll see all the output printed to the screen.

Lucia Brammer
1,327 PointsThanks!