Different types of rounding and different result
Why is it, I was checking the mathematics rules, where was saying that after 0.5 we are rounding to 1 but in the second operation rounded to 0 and gives me the wrong answer
Different types of rounding and different result
Why is it, I was checking the mathematics rules, where was saying that after 0.5 we are rounding to 1 but in the second operation rounded to 0 and gives me the wrong answer
Copyright © 2021 Jogjafile Inc.
The documentation for Number.prototype.toFixed() describes what's happening in this exact case: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed