.length in a function

Im currently starting a bootcamp and we had this function example in the javascript functions module I am revisiting. Something I am not grasping is why we only use .length for the first argument student answers in the for loop. How does the function know what position it needs to match in teachers answers array?

It’s built on the assumption that the first item in the student’s answers corresponds to the first item in the teacher’s answers, same for the second item and third item and so on. This has nothing to do with JS and more to do with how you as the developer structure the data.

1 Like