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!
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
Amin Ruhul
Courses Plus Student 4,762 PointsUpdated Answer to Solve multiple answers
var message = '';
var student;
var search;
var searchResult = [];
function print(message) {
var ouputDiv = document.getElementById('output');
ouputDiv.innerHTML = message;
}
function getStudentRecord(student){
var report = '<h2>Student: ' + student.name + '</h2>';
report += '<p>Track: ' + student.track + '</p>';
report += '<p>Achievement: ' + student.achievement + '</p>';
report += '<p>Points: ' + student.points + '</p>';
return report;
}
while(!searchResult.length){
search = prompt('Search Student records: Type the name of the Student, type quit to quit this:')
if(search === null || search.toLowerCase() === 'quit'){
break;
}
for (var i=0; i < students.length; i +=1){
student = students[i];
if(student.name === search){
searchResult.push(student);
}
}
}
for (var j=0; j < searchResult.length; j +=1){
message += getStudentRecord(searchResult[j]);
print(message);
}
Tracy Excell
Front End Web Development Techdegree Graduate 15,333 PointsTracy Excell
Front End Web Development Techdegree Graduate 15,333 PointsWhat specifically are you having trouble with?