Created
June 5, 2018 01:02
-
-
Save waitkafuka/ca378c082044c98fd22465f7e4bbeae4 to your computer and use it in GitHub Desktop.
// source http://jsbin.com
This file contains hidden or 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 getMiddle(a,b){ | |
var result = (a+b)/2; | |
var min = Math.floor(result); | |
var max = Math.ceil(result); | |
if(min === max){ | |
return [min]; | |
} | |
return [min,max] | |
} | |
console.log(getMiddle(1,10)) | |
console.log(getMiddle(1,11)) | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function getMiddle(a,b){ | |
var result = (a+b)/2; | |
var min = Math.floor(result); | |
var max = Math.ceil(result); | |
if(min === max){ | |
return [min]; | |
} | |
return [min,max] | |
} | |
console.log(getMiddle(1,10)) | |
console.log(getMiddle(1,11))</script></body> | |
</html> |
This file contains hidden or 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 getMiddle(a,b){ | |
var result = (a+b)/2; | |
var min = Math.floor(result); | |
var max = Math.ceil(result); | |
if(min === max){ | |
return [min]; | |
} | |
return [min,max] | |
} | |
console.log(getMiddle(1,10)) | |
console.log(getMiddle(1,11)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment