Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Guessing Game</title>
- </head>
- <body>
- <h1>Dogs or Cats?</h1>
- </body>
- <script>
- var userfirstname = prompt('What is your first name');
- console.log('user = ' + userfirstname);
- var userlastname = prompt('Hi ' + userfirstname + ' What is your last name?');
- console.log('user last name = ' + userlastname);
- var usercity = prompt('So ' + userfirstname + ' ' + userlastname + ' Where do you live?');
- console.log('user city = ' + usercity);
- var animal = prompt('Ok ' + userfirstname + ' Do you like Cats or Dogs?');
- console.log('user animal = ' + animal);
- if (animal === 'Cats') {
- alert(userfirstname + ' ' + userlastname + ' who lives in ' + usercity + ' You are crazy!!!');
- }
- else if (animal === 'Dogs') {
- alert(userfirstname + ' ' + userlastname + ' ' + usercity + ' is an awsome place to have a Dog!');
- }
- else {
- alert(userfirstname + ' Maybe you should move somewhere else.');
- }
- </script>
- </html>
Add Comment
Please, Sign In to add comment