Created
May 19, 2020 15:45
-
-
Save alabobriggs/16bfc8f96409ec7791c6501b8183568b to your computer and use it in GitHub Desktop.
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
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