toFixed
number.toFixed
function financial(x) {
return Number.parseFloat(x).toFixed(2);
}
financial(123.456); // "123.46"
financial(0.004); // "0.00"
financial('1.23e+5'); // "123000.00"Syntax
numObj.toFixed([digits])Parameters
Return value
Exceptions
Description
Examples
toFixed μ¬μ©
Last updated