Skip to content

Instantly share code, notes, and snippets.

@sethschori
Forked from anonymous/Open Sesame (1.3).js
Created July 31, 2016 17:14
Show Gist options
  • Save sethschori/b320ae7ea2a56bd4fd3f4db977436130 to your computer and use it in GitHub Desktop.
Save sethschori/b320ae7ea2a56bd4fd3f4db977436130 to your computer and use it in GitHub Desktop.
https://repl.it/CRt7/49 created by sethopia
/*
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);
Native Browser JavaScript
>>> You're In!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment