Which type of variable should I use in order to calculate double values without floating points?
i.e. let x = 0.6;
I want x*3/4 to be calculated as 0.45 instead of 0.44999999999999996.
There is only one type of number in Javascript... Number :)
You might try something like .toFixed()
(0.6 * 3/4).toFixed(2) => 0.45
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With