Created
February 3, 2015 03:58
-
-
Save chaseconey/e6aaacfa02475f6d153d to your computer and use it in GitHub Desktop.
// source http://jsbin.com/wexegi
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"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
// The previous chapter introduced the standard function Math.min that returns its smallest argument. We can do that ourselves now. Write a function min that takes two arguments and returns their minimum. | |
// Your code here. | |
// console.log(min(0, 10)); | |
// → 0 | |
// console.log(min(0, -10)); | |
// → -10 | |
// URL: http://eloquentjavascript.net/03_functions.html#p_aW/Uoj4mDd | |
function min(x, y) { | |
if (x < y) { | |
return x; | |
} | |
return y; | |
} | |
console.log(min(0, 10)); | |
console.log(min(0, -10)); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">// The previous chapter introduced the standard function Math.min that returns its smallest argument. We can do that ourselves now. Write a function min that takes two arguments and returns their minimum. | |
// Your code here. | |
// console.log(min(0, 10)); | |
// → 0 | |
// console.log(min(0, -10)); | |
// → -10 | |
// URL: http://eloquentjavascript.net/03_functions.html#p_aW/Uoj4mDd | |
function min(x, y) { | |
if (x < y) { | |
return x; | |
} | |
return y; | |
} | |
console.log(min(0, 10)); | |
console.log(min(0, -10));</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
// The previous chapter introduced the standard function Math.min that returns its smallest argument. We can do that ourselves now. Write a function min that takes two arguments and returns their minimum. | |
// Your code here. | |
// console.log(min(0, 10)); | |
// → 0 | |
// console.log(min(0, -10)); | |
// → -10 | |
// URL: http://eloquentjavascript.net/03_functions.html#p_aW/Uoj4mDd | |
function min(x, y) { | |
if (x < y) { | |
return x; | |
} | |
return y; | |
} | |
console.log(min(0, 10)); | |
console.log(min(0, -10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment