Skip to content

Instantly share code, notes, and snippets.

Created April 12, 2016 16:28
Show Gist options
  • Save anonymous/dce7d7ba3e1f7f363c76bfa1005beabc to your computer and use it in GitHub Desktop.
Save anonymous/dce7d7ba3e1f7f363c76bfa1005beabc to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/xadasu
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
function addNums(a, b){
return a + b;
}
console.log('add: ' + addNums(2,4));
function multNums(a, b){
return a * b;
}
console.log('mult: ' + multNums(2,4));
function modNums(a, b){
return a % b;
}
console.log('mod: ' + modNums(2,4));
function divNums(a, b){
return a / b;
}
console.log('div: ' + divNums(2,4));
function subNums(a, b){
return a - b;
}
console.log('subtract: ' + subNums(2,4));
function increment(a){
return a++;
}
console.log('increment: ' + increment(2));
function decrement(a){
return a--;
}
console.log('decrement: ' + decrement(2));
function expNumsMath(a, b){
return Math.pow(a, b);
}
console.log('exp via Math: ' + expNumsMath(2,4));
function absNum(a){
return Math.abs(a);
}
console.log('abs: ' + absNum(-4));
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
console.log('rando: ' + getRandomInt(3, 12));
function getRandomIntInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log('randoInclusive: ' + getRandomIntInclusive(23, 1112));
</script>
<script id="jsbin-source-javascript" type="text/javascript">function addNums(a, b){
return a + b;
}
console.log('add: ' + addNums(2,4));
function multNums(a, b){
return a * b;
}
console.log('mult: ' + multNums(2,4));
function modNums(a, b){
return a % b;
}
console.log('mod: ' + modNums(2,4));
function divNums(a, b){
return a / b;
}
console.log('div: ' + divNums(2,4));
function subNums(a, b){
return a - b;
}
console.log('subtract: ' + subNums(2,4));
function increment(a){
return a++;
}
console.log('increment: ' + increment(2));
function decrement(a){
return a--;
}
console.log('decrement: ' + decrement(2));
function expNumsMath(a, b){
return Math.pow(a, b);
}
console.log('exp via Math: ' + expNumsMath(2,4));
function absNum(a){
return Math.abs(a);
}
console.log('abs: ' + absNum(-4));
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
console.log('rando: ' + getRandomInt(3, 12));
function getRandomIntInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log('randoInclusive: ' + getRandomIntInclusive(23, 1112));
</script></body>
</html>
function addNums(a, b){
return a + b;
}
console.log('add: ' + addNums(2,4));
function multNums(a, b){
return a * b;
}
console.log('mult: ' + multNums(2,4));
function modNums(a, b){
return a % b;
}
console.log('mod: ' + modNums(2,4));
function divNums(a, b){
return a / b;
}
console.log('div: ' + divNums(2,4));
function subNums(a, b){
return a - b;
}
console.log('subtract: ' + subNums(2,4));
function increment(a){
return a++;
}
console.log('increment: ' + increment(2));
function decrement(a){
return a--;
}
console.log('decrement: ' + decrement(2));
function expNumsMath(a, b){
return Math.pow(a, b);
}
console.log('exp via Math: ' + expNumsMath(2,4));
function absNum(a){
return Math.abs(a);
}
console.log('abs: ' + absNum(-4));
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
console.log('rando: ' + getRandomInt(3, 12));
function getRandomIntInclusive(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
console.log('randoInclusive: ' + getRandomIntInclusive(23, 1112));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment