Javascript says 0.7-0.2 is equal to 0.49999999999999994.
The case is the following:
var change = 0.7 - 0.2;
switch (change) {
if (change.toFixed(2) >= 1) {
...
}
else if (change.toFixed(2) >= 0.50) {
...
}
else if (change.toFixed(2) >= 0.20) {
...
}
...
}
By using .toFixed() method, the problem is solved but is there another way, instead of using .toFixed() n-times;