Skip to content

Instantly share code, notes, and snippets.

@terrancebryant
Created October 15, 2013 23:47
Show Gist options
  • Save terrancebryant/7000450 to your computer and use it in GitHub Desktop.
Save terrancebryant/7000450 to your computer and use it in GitHub Desktop.
<!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>
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