javascript - js formatted data
世界只因有你
世界只因有你 2017-05-18 10:56:09
0
3
885

For example:
10 is formatted as 10.00
1.1 is formatted as 1.10
2.21 is formatted as 2.21

No other circumstances

There is BigDecimal in java that can be used. Is there anything similar in js?

世界只因有你
世界只因有你

reply all(3)
Ty80

.toFixed(2)

曾经蜡笔没有小新

printf module

const printf = require('printf')
printf('%.2f', 10) //10.00

toFixed method

(10).toFixed(2) //10.00
習慣沉默

Use toFixed (number of decimal places)

var a=1;
a.toFixed(2) //"1.00"
typeof a // "number"
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template