For example: 10 is formatted as 10.001.1 is formatted as 1.102.21 is formatted as 2.21
No other circumstances
There is BigDecimal in java that can be used. Is there anything similar in js?
.toFixed(2)
const printf = require('printf') printf('%.2f', 10) //10.00
(10).toFixed(2) //10.00
Use toFixed (number of decimal places)
var a=1; a.toFixed(2) //"1.00" typeof a // "number"
.toFixed(2)
printf module
toFixed method
Use toFixed (number of decimal places)