Use toFixed
:
function price (number) {
return '$' + number.toFixed(2);
}
Here’s the fiddle: http://jsfiddle.net/Uc7x3/
2
solved How do you make a price in javascript? ex $1.99 [duplicate]
Use toFixed
:
function price (number) {
return '$' + number.toFixed(2);
}
Here’s the fiddle: http://jsfiddle.net/Uc7x3/
2
solved How do you make a price in javascript? ex $1.99 [duplicate]