bluebones.net

Icon

Adventures in Computer Programming

Rounding in Javascript

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

Category: Uncategorized

Tagged:

Leave a Reply