Created
April 13, 2017 07:53
-
-
Save JTLR/09832de4fd984906cf63c73d63b9cbf1 to your computer and use it in GitHub Desktop.
Javascript round to nth decimal place
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 round(value, decimals) { | |
return Number(Math.round(value+'e'+decimals)+'e-'+decimals); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment