false , 0 , -0 , 0n (BigInt zero), "" , null , undefined , NaN .
Both get converted to strings and concatenated. Not an error. Not useful. Just... weird. JavaScript’s weird parts aren’t bugs—they’re historical artifacts. Brendan Eich built this language in 10 days in 1995. It had to be flexible, forgiving, and fast.
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 : javascript weird parts
JavaScript inserts a semicolon after return . It becomes return; and the object is never reached.
const obj = { show }; obj.show(); // obj false , 0 , -0 , 0n (BigInt
If you’ve spent more than 48 hours with JavaScript, you’ve probably uttered the phrase: “Wait… why did it do that?”
function getObject() { return { value: 42 } } console.log(getObject()); // undefined Not useful
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 + .