Understanding Javascript The Weird Part Parts Free -

function outer() let secret = 'closed over'; return function inner() console.log(secret); ;

Everything else is truthy (including [] , {} , "0" ). The weird part: == does type coercion. understanding javascript the weird part parts

const obj = name: 'Alice', greet() console.log(this.name); ; const greetFn = obj.greet; greetFn(); // undefined (default binding, not implicit) Fix: use arrow functions (lexical this ) or .bind() . The weird part: A function “remembers” its lexical scope even when executed outside it. function outer() let secret = 'closed over'; return