Skip to content

Instantly share code, notes, and snippets.

@droid001
Created March 21, 2020 13:35
Show Gist options
  • Save droid001/9bbf0dd9eff47542363b99fe44b150a6 to your computer and use it in GitHub Desktop.
Save droid001/9bbf0dd9eff47542363b99fe44b150a6 to your computer and use it in GitHub Desktop.
rounds off number by given amount of decimal points
export const roundOff = (num, decimalPoints)=>Math.round( num * Math.pow(10, decimalPoints) ) / Math.pow(10, decimalPoints)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment