Created
October 15, 2013 23:47
-
-
Save terrancebryant/7000450 to your computer and use it in GitHub Desktop.
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> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<button class="clickME">Click Shit</button> | |
</body> | |
</html> |
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 value1 = 3; | |
var value2 = 10; | |
var num = 10; | |
var numSheep = 4; | |
var monthsToPrint = 12; | |
$(".clickME").on("click", function() { | |
if (value1 < value2 ){ | |
console.log(value1 + " is less then " + value2); | |
} else { | |
console.log(value2 + " is greater then " + value1); | |
} | |
for(var monthNumber = 1; monthNumber <= monthsToPrint; monthNumber++) { | |
if( numSheep > 10000) { | |
numSheep = numSheep/2; | |
console.log("Removing " + numSheep + " sheep from the population. Phew!"); | |
} | |
numSheep*=4; | |
console.log("There will be " + numSheep + " sheep after " + monthNumber + " month(s)!"); | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment