Javascript Weird Parts ((exclusive)) Site
const bound = show.bind({hello: "world"}); bound(); // {hello: "world"}
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
If you’ve spent more than 48 hours with JavaScript, you’ve probably uttered the phrase: “Wait… why did it do that?” const bound = show
Put { on the same line as return . 6. this – The Shape-Shifter In most languages, this is predictable. In JavaScript, it depends on how you call the function. There are exactly 8 falsy values : If
JavaScript is the most misunderstood language in the world. Some call it broken; others call it beautiful. The truth? It’s both.
function show() { console.log(this); } show(); // window (or global in Node) new show(); // {} (the new instance)