Javascript: remove trailing zeros returned by toFixed()

const n = 12000;
console.log((n/1000).toFixed(3)); # 12.000
console.log(parseFloat((n/1000).toFixed(3))); # 12



See also

No comments:

Post a Comment