Last active
August 29, 2015 14:07
-
-
Save benadamstyles/27c1ced414aa6bb5779f to your computer and use it in GitHub Desktop.
Return a number rounded to given decimal places
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
window.namespace.round=function(v,decimalPlaces) { | |
var d=decimalPlaces||2; | |
return Number(Math.round(v+'e'+d)+'e-'+d); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment