Created
January 15, 2020 10:51
-
-
Save andrijac/a1b41677286e6e041f3c40bd1b8da5b2 to your computer and use it in GitHub Desktop.
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
var sum = function(x, y) { | |
let scale = 100; | |
return ((x*scale)+(y*scale))/scale; | |
} | |
sum(0.1, 0.2) | |
// => 0.3 | |
//OR | |
parseFloat((0.1+0.2).toFixed(2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment