Now it’s time to login. When the button is clicked, we need to loop through the username list to see if the username that was entered in the textInput box matches any username that is in our list. If we can match the username to one of the accounts in the username list, then we need to check to make sure that the password in the textInput box matches the parallel password in the passwords list. If both the username and password match, then we can move to screen 2. If they do not, then we should display to the user the error, and clear out the input boxes.
var i = 0;would be searching the index 0 of list. Remember too that loops end up incrementing a variable by 1 each iteration.