Register now or log in to join your professional community.
Why we don't have the result expected and how to gracely fix it ?
The source of this issue is due to the value (0.1) being an irrational number.
To fix this and get the expected value, one way is to do this:
var res=(0.1*3).toFixed(1);
Output: "0.3"