Js The Weird Parts High Quality May 2026
console.log(0 == false); // true console.log("" == false); // true console.log(null == undefined); // true console.log(NaN == NaN); // false (yes, NaN is not equal to itself) The rule is simple: . It compares both value and type. The == operator tries to be "helpful" by converting types behind your back. That "help" is the source of countless bugs. NaN : The Loneliest Number Speaking of NaN (Not a Number), it has a personality disorder.
If you’ve spent more than five minutes writing JavaScript, you’ve probably had a moment where you stared at your screen and whispered, “...why?” js the weird parts
function showThis() { console.log(this); } showThis(); // window (or undefined in strict mode) console
Welcome to the weird parts. Let’s start with the most infamous party trick. That "help" is the source of countless bugs
