How would I be able to show only a whole number and 1 decimal place when writing to an html document with Javascript EX) 159.7 instead of 159.70000000000033? Right now I use document.getElementById("cookies").innerHTML = cookies; to write a variable to a document along with id="cookies".
Asked
Active
Viewed 10 times
-1
user17970437
- 1
- 1
-
Does this help : https://stackoverflow.com/questions/11832914/how-to-round-to-at-most-2-decimal-places-if-necessary ? – Marius ROBERT May 24 '22 at 14:54