Created
February 18, 2019 10:04
-
-
Save basicssm/7cf43bceaf0d16517e2b6b02dc9ae014 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/cujiweq
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"> | |
"use strict"; | |
var movements = [11.22, 3.12, 5.8, 3, 100.2]; | |
var boost = 2; | |
function roundCalc(movements) { | |
return movements.reduce(function (acc, movement) { | |
return acc + (Math.ceil(movement) - movement); | |
}, 0); | |
} | |
console.log(roundCalc(movements) * boost); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">const movements = [11.22, 3.12, 5.8, 3, 100.2]; | |
const boost = 2; | |
function roundCalc(movements){ | |
return movements.reduce((acc, movement) => acc + (Math.ceil(movement) - movement), 0); | |
} | |
console.log(roundCalc(movements) * boost);</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
"use strict"; | |
var movements = [11.22, 3.12, 5.8, 3, 100.2]; | |
var boost = 2; | |
function roundCalc(movements) { | |
return movements.reduce(function (acc, movement) { | |
return acc + (Math.ceil(movement) - movement); | |
}, 0); | |
} | |
console.log(roundCalc(movements) * boost); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment