Arrow functions don't have their own this —they inherit from the parent scope. That’s often a lifesaver, but it’s another thing to memorize. Every value in JS is inherently truthy or falsy. There are exactly 8 falsy values :
console.log(typeof NaN); // "number" According to the IEEE 754 floating-point spec (which JS uses), NaN is a numeric data type that represents an invalid number. It’s a number that isn’t a number. The weirdness doesn't stop there: javascript weird parts
Use a small epsilon or multiply by powers of 10 for money calculations (or use BigInt for integers). 5. Automatic Semicolon Insertion (ASI) JavaScript tries to be helpful. Sometimes too helpful. Arrow functions don't have their own this —they
if ([]) console.log("truthy"); // Runs! if ({}) console.log("truthy"); // Runs! Empty array and empty object? Truthy. But if ([] == false) ? That’s true (see point #2). Consistency? Not today. JavaScript defines weird type coercion rules for + . There are exactly 8 falsy values : console
console.log(0.1 + 0.2); // 0.30000000000000004 console.log(0.1 + 0.2 === 0.3); // false Floating-point math. JavaScript uses binary floating point; 0.1 in binary is a repeating fraction (like 1/3 in decimal). It can't be represented exactly.