Javascript Number round(digits)

Description

Javascript Number round(digits)

Number.prototype.round = function(digits) {
 if(digits == null)
  return Math.round(this);
 var power = Math.pow(10, digits);
 return Math.round(this * power) / power;
};



PreviousNext

Related