Skip to content

Instantly share code, notes, and snippets.

@aryak007
Created March 26, 2018 19:57
Show Gist options
  • Save aryak007/881df6ac3553bc8e6833ce55c610619b to your computer and use it in GitHub Desktop.
Save aryak007/881df6ac3553bc8e6833ce55c610619b to your computer and use it in GitHub Desktop.
function secretPassword() {
var password = 'xh38sk';
return {
guessPassword: function(guess) {
if (guess === password) {
return true;
} else {
return false;
}
}
}
}
var passwordGame = secretPassword();
passwordGame.guessPassword('heyisthisit?'); // false
passwordGame.guessPassword('xh38sk'); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment