Advertisement
ujiajah1

prompt if/else

Sep 26th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Check if the user is ready to play!
  2. confirm ("You ready to play!");
  3. var age =  prompt("What's your age");
  4. if(age < 13){
  5.     console.log("user that they're allowed to play but you take no responsibility.");
  6. }
  7. else
  8. {
  9.     console.log("give them an encouraging message to play on!");
  10. }
  11. var myName = "You are at a Justin Bieber concert, and you hear this lyric 'Lace my shoes off, start racing.'";
  12.  
  13. console.log(myName);
  14. var storyline = ("Suddenly, Bieber stops and says, 'Who wants to race me?'");
  15. console.log(storyline);
  16. var userAnswer = prompt("Do you want to race Bieber on stage?");
  17. if(userAnswer == "yes"){
  18.     console.log("You and Bieber start racing. It's neck and neck! You win by a shoelace!");
  19. } else if(userAnswer !== "yes") {
  20.     console.log("Oh no! Bieber shakes his head and sings 'I set a pace, so I can race without pacing.'");
  21. }
  22. var feedback = prompt("rate your game from  1-10, what is you rate?");
  23. if(feedback > 8){
  24.     console.log("Thank you! We should race at the next concert!");
  25. } else if (feedback >! 8){
  26.     console.log("I'll keep practicing coding and racing.");
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement