0

Maybe I have a mental problem, but I'm referring to a problem like this:

let a=0.1;
let b=0.2;
let c=0.3;
let message='';

if((a+b) === c) {
    message='Hello!';
} else {
    message='Bye!';
}

console.log(message);

It return false ("bye" in this case). And I discovered why recently.

Exist a complete guide for all this particular, or "non-ordinary", issue cases of Javascript?

Gp90
  • 55
  • 5
  • 1
    This isn't anything JavaScript-specific, it's how floating-point math in general works. And I can't imagine a complete list of all such things exists, especially since it's so subjective whether something counts as "non-ordinary" or not. – John Montgomery Oct 30 '20 at 21:14
  • 1
    I think you're looking for this https://github.com/denysdovhan/wtfjs. – Ayush Jain Oct 30 '20 at 21:45
  • @AyushJain exacly, thanks! – Gp90 Oct 30 '20 at 22:39

0 Answers0