Created
July 31, 2016 17:14
-
-
Save anonymous/3af9d06c0a28e89df6461346981b7e65 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