2 ms·
Javascript: console.log((0.1 + 0.2) === 0.3) // => false C#: (0.1m + 0.2m) == 0.3m // => true see here: https://dotnetfiddle.net/zVnrNQ https://dotnetfiddle
by dr0nkprogrammer 6y ago
Javascript:
console.log((0.1 + 0.2) === 0.3) // => false
C#:
(0.1m + 0.2m) == 0.3m // => true
see here:
https://dotnetfiddle.net/zVnrNQ https://dotnetfiddle.net/zVnrNQ
Javascript is such a poor language, there is no even a good way to work with currencies or exact numbers and you have to multiply numbers with a factor to avoid such problems. The worst language I ever used.