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
Jason Pallone
11,340 Pointscan someone help me with this please
if you go to the student.js and go to the for loop towards the bottom, ok so i get how all the code runs and everything, but what im confused with is after it loops through students, it stores the loop information into student variable, but then for the IF statement, how does the script know what name to match it too? Like i get if i type in Dave the IF statement is true and continues to run the 2 functions, but in the studentreport function, how does it know which index value to get from? Once the IF statement is true, is what was entered into user, is that index value passed to the studentreport function? because i thought the code in the if statement is just to determine if true than whats in the bracket is the code that runs. I'm so confused here,
thanks for any help sorry if its a hard to understand question, I don't understand it to well so its kinda hard to explain what I mean
1 Answer
Justin Crawford
16,736 PointsThe value of student.name is being passed to the studentreport function, not the index of students.