Javascript Number toFixed(num)

Description

Javascript Number toFixed(num)



function toFixed(num){
  var divisor = parseInt(1 + "0".repeat(num));
  return Math.round(this*divisor)/divisor
}

Number.prototype.toFixed = toFixed



PreviousNext

Related