Note that there are some explanatory texts on larger screens.

plurals
  1. POJs Password Array
    primarykey
    data
    text
    <p><strong>My Homework</strong> "Create a basic web page that will update Assignment 3.4. Create an array that will store at least eight valid passwords. Then, ask the user for a password using a prompt dialog. Utilize a for-loop to navigate the password array. If the user's input matches any string in the array, give them feedback that the password is valid. Otherwise, let them know that it is invalid.</p> <p>You do not necessarily have to include any feature that give them a chance to re-enter the password. This can simply be a one-time search of the password array."</p> <p>This is for my javascript class... so far I have this:</p> <pre><code>var accepted_passwords = new Array ( ); accepted_passwords[0] = "Saginaw"; accepted_passwords[1] = "Bay City"; accepted_passwords[2] = "Midland"; accepted_passwords[3] = "Reese"; accepted_passwords[4] = "Millington"; accepted_passwords[5] = "Frankenmuth"; accepted_passwords[6] = "Sheilds"; accepted_passwords[7] = "Birch Run"; var random_bg = new Array ( ); random_bg[0] = "#0000CC"; random_bg[1] = "#33FF33"; random_bg[2] = "#990000"; random_bg[3] = "#9900FF"; random_bg[4] = "#CC0000"; random_bg[5] = "#FF00CC"; var enterpassword; enterpassword = prompt("Enter Password", ""); for(0 &lt;= i &lt;= 7; enterpassword = accepted_passwords[i];) { document.body.style.background=random_bg[Math.floor(Math.random()*random_bg.length)]; } </code></pre> <p><br> Its supposed to ask for a password... and then if you get it right... it displays one of the five random colors. The random color part works... its the password part that doesn't. I can do this no problem with an if else statement... but apparently my teacher wants a for loop?????? Please help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload