Skip to content

Instantly share code, notes, and snippets.

@alabobriggs
Created May 19, 2020 15:45
Show Gist options
  • Save alabobriggs/16bfc8f96409ec7791c6501b8183568b to your computer and use it in GitHub Desktop.
Save alabobriggs/16bfc8f96409ec7791c6501b8183568b to your computer and use it in GitHub Desktop.
const treasurehunt = {
input_1: 'right',
input_2: 'left',
input_3: 'forward',
input_4: 'back'
};
function game() {
let user_input = prompt('enter a direction');
if (user_input === treasurehunt.input_1) {
return alert('Wasted!!!, you were killed by a bear, try again');
}
if (user_input === treasurehunt.input_2) {
return alert('Wasted!!!, you were killed by a bear, try again');
}
if (user_input === treasurehunt.input_3) {
return alert('you fell off a cliff, try again');
}
if (user_input === treasurehunt.input_4) {
return alert('congratulations you found the treasurehun');
}
user_input = prompt('Wrong direction young man');
}
game();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment