add .00 for numbers

hello
5 Replies
NIMA
NIMAβ€’3mo ago
is there any way to add .00 for the number with no . and add a extera .0 to number have 1.0 ?
Chooβ™šπ•‚π•šπ•Ÿπ•˜
MDN Web Docs
Number.prototype.toFixed() - JavaScript | MDN
The toFixed() method of Number values returns a string representing this number using fixed-point notation with the specified number of decimal places.
13eck
13eckβ€’3mo ago
Do note that Number.toFixed() changes it from a number to a string
NIMA
NIMAβ€’3mo ago
tnx alot
13eck
13eckβ€’3mo ago
JavaScript numbers are all 64-bit floats so 1 is the exact same thing as 1.00. When there is nothing after the decimal JS truncates it, assuming you wanted an integer
Want results from more Discord servers?
Add your server