mattlundstrom
5/22/2014 - 9:36 PM

Rounding

Rounding

function roundToDecimal( number, decimalPlaces ){
  var multiplier = Math.pow( 10, decimalPlaces );
  return Math.round( number * multiplier ) / multiplier;
}

function roundNearest( number, nearest ){
  return Math.round( number / nearest ) * nearest;
}