If you’ve spent more than 48 hours with JavaScript, you’ve probably uttered the phrase: “Wait… why did it do that?”
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
console.log(1 + "2"); // "12" (string) console.log(1 + 2 + "3"); // "33" (evaluates left to right: 3 + "3") console.log([] + []); // "" (empty string) console.log([] + {}); // "[object Object]" console.log({} + []); // 0 (Wait, run this in a console... yes, 0) The last one is a parsing edge case where {} is interpreted as an empty code block, not an object. This one angers accountants and mathematicians equally. If you’ve spent more than 48 hours with
const bound = show.bind({hello: "world"}); bound(); // {hello: "world"} There are exactly 8 falsy values : console