Created
October 13, 2017 22:41
-
-
Save JesterMan/782a93e9568b9b2653c8bc9ccf328ffb to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/qeteful
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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
function returnMin(x,y){ | |
if(x>y){console.log(y)} | |
else {console.log(x)} | |
} | |
function isEven(num){ | |
if (num===0){console.log("true")} | |
if (num===1){console.log("false")} | |
if (num > 1){isEven(num-2)} | |
if (num <0){isEven(num+2)} | |
} | |
function charCount(str, letter){ | |
var count=0; | |
for (var i =0; i<str.length; i++){ | |
if (str[i] === letter){count++} | |
} | |
console.log(count) | |
} | |
console.log("==== exercise 1 ====") | |
returnMin(0,10) | |
returnMin(0,-10) | |
console.log("==== exercise 2 ====") | |
isEven(50) | |
isEven(75) | |
isEven(-1) | |
console.log("==== exercise 3 ====") | |
charCount("BBC", "B") | |
charCount("kakkerlak", "k") | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function returnMin(x,y){ | |
if(x>y){console.log(y)} | |
else {console.log(x)} | |
} | |
function isEven(num){ | |
if (num===0){console.log("true")} | |
if (num===1){console.log("false")} | |
if (num > 1){isEven(num-2)} | |
if (num <0){isEven(num+2)} | |
} | |
function charCount(str, letter){ | |
var count=0; | |
for (var i =0; i<str.length; i++){ | |
if (str[i] === letter){count++} | |
} | |
console.log(count) | |
} | |
console.log("==== exercise 1 ====") | |
returnMin(0,10) | |
returnMin(0,-10) | |
console.log("==== exercise 2 ====") | |
isEven(50) | |
isEven(75) | |
isEven(-1) | |
console.log("==== exercise 3 ====") | |
charCount("BBC", "B") | |
charCount("kakkerlak", "k")</script></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
function returnMin(x,y){ | |
if(x>y){console.log(y)} | |
else {console.log(x)} | |
} | |
function isEven(num){ | |
if (num===0){console.log("true")} | |
if (num===1){console.log("false")} | |
if (num > 1){isEven(num-2)} | |
if (num <0){isEven(num+2)} | |
} | |
function charCount(str, letter){ | |
var count=0; | |
for (var i =0; i<str.length; i++){ | |
if (str[i] === letter){count++} | |
} | |
console.log(count) | |
} | |
console.log("==== exercise 1 ====") | |
returnMin(0,10) | |
returnMin(0,-10) | |
console.log("==== exercise 2 ====") | |
isEven(50) | |
isEven(75) | |
isEven(-1) | |
console.log("==== exercise 3 ====") | |
charCount("BBC", "B") | |
charCount("kakkerlak", "k") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment