Rounding in Javascript

function round(num, decimalPlaces) {
   n = Math.pow(10, decimalPlaces);
   return Math.round(num * n) / n;
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.