3
I’m new to programming, I ran a division account and I wanted to reduce the decimals.
Follow my code below!
document.write("A média de gerações que se passaram é: " + (2019/28));
Obs: Result 72.10714285714286.
I wanted to reduce that number to two houses only, as I do?
Thanks in advance!
@Leandrade does not think it is duplicated because it has nothing to do with the problems of errors in the way Javascript behaves in mathematical calculations.
2019 / 28
is even a number with many decimal places .– Sergio
@Sergio alright I withdrew my vote, although, I believe that in the first answer it is very clear how to set decimal places in javascript with toFixed().
– LeAndrade
Possible duplicate of Javascript generating float with multiple decimals
– Icaro Martins
Possible duplicate of Rounding with 2 decimal places in javascript using a specific rule?
– Luiz Felipe