I am trying to write a piece of code that will search an existing array of usernames and see if the name entered by a user (which will be in a prompt box) is in that array of user names and if so then ask them for their password. I'm not sure if I use a for loop to check through the array of usernames and then use an expression saying if the user name entered is equal to one of the names in the array, or am I completely on the wrong tracks?? As you can tell I'm very new to javascript and any help would be greatly appreciated

First of all this is a java forum. Java and javascript are entirely different.
If the users in the array are not sorted then you are right on how to do it.