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.

Mariana Castilho
Front End Web Development Techdegree Graduate 13,842 PointsDifferent logic but I guess it shoud work
Hi! I did the challenge using a slightly different structure but I guess it should work...but after I enter the student name in the prompt, nothing is displayed in the page.
while(true) {
var input = prompt('Selecione nome para pesquisar');
if(input.toLowerCase() === 'quit' || input === null) {
break;
} else {
for (var i = 0; i < student.length; i += 1) {
studentName = student[i].name;
if(studentName === input) {
message += '<h2>Student: ' + student.name + '</h2>';
message += '<p>Track: ' + student.track + '</p>';
message += '<p>Points: ' + student.points + '</p>';
message += '<p>Achievements: ' + student.achievements + '</p>';
print(message);
}
}
}
}
1 Answer

Dmitry Polyakov
4,964 PointsWhen you loop through students array in your for loop you need to grab the student object, not just student's name
studentName = student[i].name; - this line might cause the issue
We have student variable initialised at the top and we need to assign student object to this variable
student = students[i];