Last active
August 29, 2015 14:06
-
-
Save foglabs/27fe2f1dc86aa5d9310f to your computer and use it in GitHub Desktop.
Guess Tha Numbah JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var secretNumber = Math.random()*100; | |
secretNumber = Math.round(secretNumber); | |
var name = prompt("What's yo name baby?"); | |
for(i = 0; i < 10; i++) { | |
var guess = prompt("Enter your guess, baby!"); | |
if(guess == secretNumber) { | |
alert(name + ' wins!!!!'); | |
i = 10; | |
} | |
if(guess > secretNumber) { | |
alert('Too High!'); | |
} | |
if(guess < secretNumber) { | |
alert('Too Low!'); | |
} | |
} | |
if(guess != secretNumber) { | |
alert("You're garbage!"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Guess the Number</title> | |
</head> | |
<body> | |
<script src="guess_the_number.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment