Simple Javascript game with inputs from user
confirm("I am ready to play!");
var age = prompt("What's your age");
if(age < 13) {
console.log("You can play but that's none of my business");
}
else {
console.log("Then let's get started!");
}
console.log("You are at a concert, and you hear this lyric 'Lace my shoes off, start racing.'");
console.log("Suddenly, the singer stops and says, 'Who wants to race me?'");
userAnswer = prompt("Do you want to race him on stage?");
if(userAnswer = "yes"){
console.log("You and him start racing. It's neck and neck! You win by a shoelace!");
}
else{
console.log("Oh no! He shakes his head and sings 'I set a pace, so I can race without pacing.'");
}
var feedback = prompt("Please rate this game from 1-10");
if(feedback < 8) {
console.log("Thank you! We should race at the next concert!");
}
else {
console.log("I'll keep practicing coding and racing.");
}
Written by donovan adams
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Game
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#