Guest User

Untitled

a guest
Oct 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Guessing Game</title>
  5. </head>
  6. <body>
  7. <h1>Dogs or Cats?</h1>
  8. </body>
  9. <script>
  10. var userfirstname = prompt('What is your first name');
  11. console.log('user = ' + userfirstname);
  12.  
  13. var userlastname = prompt('Hi ' + userfirstname + ' What is your last name?');
  14. console.log('user last name = ' + userlastname);
  15.  
  16. var usercity = prompt('So ' + userfirstname + ' ' + userlastname + ' Where do you live?');
  17. console.log('user city = ' + usercity);
  18.  
  19. var animal = prompt('Ok ' + userfirstname + ' Do you like Cats or Dogs?');
  20. console.log('user animal = ' + animal);
  21.  
  22. if (animal === 'Cats') {
  23. alert(userfirstname + ' ' + userlastname + ' who lives in ' + usercity + ' You are crazy!!!');
  24. }
  25. else if (animal === 'Dogs') {
  26. alert(userfirstname + ' ' + userlastname + ' ' + usercity + ' is an awsome place to have a Dog!');
  27. }
  28. else {
  29. alert(userfirstname + ' Maybe you should move somewhere else.');
  30. }
  31.  
  32. </script>
  33.  
  34. </html>
Add Comment
Please, Sign In to add comment