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 trialTibor Ruzinyi
17,968 PointsCode not working: Unexpected identifier
Hello all, I am trying to do this challange but my code is not woking. Do somebody know where i did mistake ?
var loppThruNames = function(students) {
for(var i = 0; i < students.length ; i++){
var promptname = prompt("Type Name");
if students[i].Name === promptname{
print(students[i].Name + students[i].Track)
}else if{
print("Sorry Student not found");
}else{
if promptname.toLowerCase === 'quit'{
break;
}
}
}
}
loopThruNames(students);
```
5 Answers
MIke Allen
9,727 PointsHi Tibor,
One thing I noticed is your loops are not correct syntax.
Your one is currently setup like
if students[i].Name === promptname{
print(students[i].Name + students[i].Track)
But if's need to be like this
if(students[i].Name === promptname) {
print(students[i].Name + students[i].Track)
}
You just missed the brackets around your condition.
Hope that helps.
Pete Cass
16,656 Pointsyou've got a typo in var loopthoughnames
Pete Cass
16,656 Pointsand now so have i ;)
Tibor Ruzinyi
17,968 Pointshahaha thx , ive repaired the typo but it still says : Uncaught SyntaxError: Unexpected identifier
Tibor Ruzinyi
17,968 PointsThank you very much guys for your help