Javascript Number toDecimal(value)

Description

Javascript Number toDecimal(value)



Number.prototype.toDecimal = function(value) { 
  var precision = 2; 
  var power     = Math.pow(10, precision || 0);
  return String(Math.round(value * power) / power);
};



PreviousNext

Related