Javascript Number floatMethod()

Description

Javascript Number floatMethod()


Number.prototype.floatMethod = function() {
    return parseFloat(this).toFixed(2);
};
function convert_float() {
    var n = 60.00;
   console.log(n.floatMethod());//  w ww .  j  ava 2s.co  m
}convert_float(n);



PreviousNext

Related