Skip to content

Instantly share code, notes, and snippets.

Created July 31, 2016 17:14
Show Gist options
  • Save anonymous/3af9d06c0a28e89df6461346981b7e65 to your computer and use it in GitHub Desktop.
Save anonymous/3af9d06c0a28e89df6461346981b7e65 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