Skip to content

Instantly share code, notes, and snippets.

@katherineschultz
Created October 14, 2014 01:00
Show Gist options
  • Save katherineschultz/d64f77e75ba18e09ffa9 to your computer and use it in GitHub Desktop.
Save katherineschultz/d64f77e75ba18e09ffa9 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
p {
background-color: orange;
}
</style>
</head>
<body>
<p>This is a paragraph about some stuff</p>
<a href = "#" onclick="calculate()">
Calculate life time supply
</a>
<script>
var age = 35;
var maxAge = 100;
var gum = 500;
var stockUp = (maxAge - age) * gum;
alert ("You will need " + stockUp + " pieces of gum to last you until your old age of " + maxAge);
if (stockUp > 40000) {
alert ("That's way too much gum!");
} else {
alert (stockUp + " pieces of gum is not a crazy amount of gum at all!");
}
function calculate(){
var age = 35;
var maxAge = 100;
var gum = 500;
var stockUp = (maxAge - age) * gum;
alert ("You will need " + stockUp + " pieces of gum to last you until your old age of " + maxAge);
if (stockUp > 40000) {
alert ("That's way too much gum!");
} else {
alert (stockUp + " pieces of gum is not a crazy amount of gum at all!");
}
}
calculate();
function cal(name){
alert ("Hi " + name + "!");
}
cal("Mitch, the dinosaur");
cal("Harold, the hippo");
var name = "Pip, the mouse";
cal(name);
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<style>
p {
background-color: orange;
}
</style>
</head>
<body>
<p>This is a paragraph about some stuff</p>
<a href = "#" onclick="calculate()">
Calculate life time supply
</a>
<script>
var age = 35;
var maxAge = 100;
var gum = 500;
var stockUp = (maxAge - age) * gum;
alert ("You will need " + stockUp + " pieces of gum to last you until your old age of " + maxAge);
if (stockUp > 40000) {
alert ("That's way too much gum!");
} else {
alert (stockUp + " pieces of gum is not a crazy amount of gum at all!");
}
function calculate(){
var age = 35;
var maxAge = 100;
var gum = 500;
var stockUp = (maxAge - age) * gum;
alert ("You will need " + stockUp + " pieces of gum to last you until your old age of " + maxAge);
if (stockUp > 40000) {
alert ("That's way too much gum!");
} else {
alert (stockUp + " pieces of gum is not a crazy amount of gum at all!");
}
}
calculate();
function cal(name){
alert ("Hi " + name + "!");
}
cal("Mitch, the dinosaur");
cal("Harold, the hippo");
var name = "Pip, the mouse";
cal(name);
<\/script>
</body>
</html>
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment