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

brandonlind2
7,823 Pointswhy arent the results in the for loop being print to the console?
javascript
var students= [
{ name: "Sarah",
track: "ios",
achievements: 20,
points: 50
}, {
name:"tom",
track: "frot end programming",
achievements: 40,
points: 60
}, {
name: "Bob",
track: "java",
achievements: 60,
points: 70
}
];
function print(message){
console.log(message);
}
while(true){
var search= prompt("Type student name for info");
if(search === null || search.toUpperCase === "quit"){
break;}
}
for(i=0; i < students.length; i+=1){
if(search.toUpperCase() === students[i].name){
var message=student.name + " " +
student.track + " " +
student.achievements + " " +
student.points;
print(message);
}
}

Gavin Ralston
28,770 PointsAlso, beware this code here: It's not going to do what you probably intended. You'll never match "quit" to an uppercased version of anything. :)
if(search === null || search.toUpperCase === "quit") { break; }
Ham Hamey
5,712 PointsHam Hamey
5,712 PointsThere were many typos in your code like student instead of students and while comparing in the if statement