Skip to content

Instantly share code, notes, and snippets.

@waitkafuka
Created June 5, 2018 01:02
Show Gist options
  • Save waitkafuka/ca378c082044c98fd22465f7e4bbeae4 to your computer and use it in GitHub Desktop.
Save waitkafuka/ca378c082044c98fd22465f7e4bbeae4 to your computer and use it in GitHub Desktop.
// source http://jsbin.com
<!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>
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