Hi
I am new to all this so please excuse my ignorance. I am trying to work out how I can check if my Array contains my declared variable and if so, for the boolean to return true, however, I dont seem to be getting anywhere. I have tried the for loop and while loop as below; I would very much appreciate any help
[CODE=javascript]var customerCodes = ['sh-12', 'gw-4', 'to-0'];
var customerPasswor ds = ['tony', 'darma', 'checks', 'lauren'];
var password;
password = window.prompt ('enter password' + '')
var customerIndex;
customerIndex = 0;
for (var index =0; index < customerPasswor ds.length; index = index + 1)
while (password != customerPasswor ds[customerIndex])
{
window.prompt ('enter correct password' + '')
}
document.write ('lala')[/CODE]
I am new to all this so please excuse my ignorance. I am trying to work out how I can check if my Array contains my declared variable and if so, for the boolean to return true, however, I dont seem to be getting anywhere. I have tried the for loop and while loop as below; I would very much appreciate any help
[CODE=javascript]var customerCodes = ['sh-12', 'gw-4', 'to-0'];
var customerPasswor ds = ['tony', 'darma', 'checks', 'lauren'];
var password;
password = window.prompt ('enter password' + '')
var customerIndex;
customerIndex = 0;
for (var index =0; index < customerPasswor ds.length; index = index + 1)
while (password != customerPasswor ds[customerIndex])
{
window.prompt ('enter correct password' + '')
}
document.write ('lala')[/CODE]
Comment