Skip to content

Instantly share code, notes, and snippets.

@ewebdev
Created February 26, 2014 14:24
Show Gist options
  • Save ewebdev/9230323 to your computer and use it in GitHub Desktop.
Save ewebdev/9230323 to your computer and use it in GitHub Desktop.
function roundNumber(val, maxDecimals) {
return (Math.round(val * Math.pow(10, maxDecimals))) / Math.pow(10, maxDecimals);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment