Home >Web Front-end >JS Tutorial >js implements the addition of two values and alerts it accurately to the specified position_javascript skills
For example: Number(4.2) Number(9.2)
The sum of these two values alerts equal to 13.3999999999999998. Why?
For example: Number(2.2) Number(9.7)
alert equals 11.899999999999998
But like this Number(2.3) Number(9.9)
alert equals 12.2. This value is what I want.
Why do some values have so many decimal places when they add up, while others don’t?