Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var number = Math.floor((Math.random()* 20) + 1);
- var name = prompt("What is your name?")
- var guess = prompt("Guess a number, 1 through 20")
- if (guess == number){
- alert("You win " + name + "!");
- } else {
- alert("You lose " + name + "!")
- }
- #index.html
- <!DOCTYPE html>
- <html>
- <head>
- <title>Guess the Number</title>
- </head>
- <body>
- <script src="guess_the_number.js"></script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement