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


searching through my object

i have watched the tutorial more than four time, i dot find a reason why my seach name is not print it on the browser.

var message = ''; var student; var search;

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; }

while (true) { search = prompt('Search student record: type a name [Dmitry] (or type "quit" to end)'); if (search === null || search.toLowerCase() === 'quit') { break; }

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

3 Answers

Steven Parker
Steven Parker
230,250 Points

You only see the results after you enter "quit" — did you do that?

You didn't provide a link to the course but I seem to recall this is explained in the "Teacher's Notes" section on that page.

HI steven i'm actually having trouble with my input prompt, the teacher explain if i don't add search === null my input it will never been an string , actually output just null instead of an string, i have been searching a lot about on the internet about i have't any clear explaination about it . i'm getting overwaming with this bug .

i will apreciate your help. https://github.com/AlejandroBryan/object here is the link to github. and here you the link to the tutorial https://teamtreehouse.com/library/the-student-record-search-challenge-solution

Steven Parker
Steven Parker
230,250 Points

If I put in a student name, then on the next prompt enter "quit", I see the student info just as expected. I don't think I understand the problem you are having.