ForgeFrontend — Prepare, Practice, Crack
Secure checkout
Lifetime access
Instant Drive delivery
Free updates forever

Prepare · Practice · Crack

JavaScript 'this' Interview Questions

The `this` keyword confuses more candidates than almost anything else. Here are the questions and clear rules.

How is the value of `this` determined?

By HOW a function is called, checked in order: new binding (the new object), explicit binding (call/apply/bind), implicit binding (obj.method() → obj), default binding (plain fn() → undefined in strict mode, else global).

What's the difference between call, apply and bind?

All set this. call invokes now with args listed; apply invokes now with an args array; bind returns a NEW function with this fixed for later.

How do arrow functions treat `this`?

They have no own this — they capture it lexically from the surrounding scope and can't be rebound. Perfect for callbacks inside methods, wrong as object methods.

What does it mean to 'lose this'?

Passing a method as a bare callback (setTimeout(obj.method)) drops the implicit binding, so this becomes undefined/global. Fix with .bind(obj) or an arrow wrapper.

What is `this` at the top level?

In a module or strict mode, this is undefined in a plain function call. In non-strict scripts, it defaults to the global object (window).

Master this and binding

The four this rules, call/apply/bind, and the closures behind them — with clear answers in the JavaScript Interview Kit.

⚡ Get the JavaScript Interview Kit → ₹299

Frequently asked questions

Why is `this` inside setTimeout undefined?
The callback is called without the dot, so the implicit binding is lost. Use an arrow function or bind to preserve this.
Can you change an arrow function's this?
No — call/apply/bind cannot change an arrow's this. It's fixed at definition time.

Full kit

JavaScript Interview Kit · ₹299

Get it →