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.