← Functions & Closures
`this` binding
Rules that determine what `this` refers to inside a function call.
new Foo()—thisis the new instance.obj.method()—thisisobj.fn.call(ctx)/fn.apply(ctx)/fn.bind(ctx)—thisisctx.- Bare
fn()—thisisundefinedin strict mode, the global object otherwise. - Arrow functions — inherit
thisfrom the enclosing lexical scope.
Interview questions
Sign in to saveWhy can arrow functions not be used as constructors?
They don't have their own `this` or `[[Construct]]` internal method, so `new` throws.
