-
-
Save sethschori/b320ae7ea2a56bd4fd3f4db977436130 to your computer and use it in GitHub Desktop.
https://repl.it/CRt7/49 created by sethopia
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
OPEN SESAME | |
Our gate function is not very secure. Choose a password from the passwords array (or write your own and add it to the array). Then, uncomment and complete the if statement and foor loop so the gate only logs an entry message when the designated password is selected by the loop | |
*/ | |
var passwords = [ | |
'Password123', | |
'DavidYangsMiddleName', | |
'qwert', | |
'S3cur3P455WORD', | |
'OpenSesame', | |
'DeadChildhoodPetsName' | |
]; | |
function gate(password, passwordsArray) { | |
for(var i = 0; i < passwords.length; i++) { | |
if(passwordsArray.indexOf(password) !== -1) { | |
console.log("You're In!"); | |
} else { | |
console.log("Not so fast buddy! You ain't gettin' in here.") | |
} | |
return; | |
} | |
} | |
gate("DeadChildhoodPetsName", passwords); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Native Browser JavaScript | |
>>> You're In! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment