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

Prepare · Practice · Crack

How is the value of `this` determined?

Quick answer

By HOW a function is called: new binding, explicit (call/apply/bind), implicit (obj.method()), then default (undefined/global).

In detail

Check in order: called with `new`? → the new object. Called with call/apply/bind? → the given object. Called as `obj.method()`? → obj. A plain `fn()` call? → undefined in strict mode, otherwise the global object. Arrow functions ignore all this and capture `this` lexically.

const o = { name: "Forge", who() { return this.name; } };
o.who();          // "Forge" (implicit)
const f = o.who;
f();              // undefined (lost the dot)

Why interviewers ask this: `this` confusion is the most common JS bug — interviewers probe it hard.

Common follow-up questions

  • What does `this` refer to inside an arrow function?

This is 1 of 118+ questions in the JavaScript Interview Kit

Get every question with detailed answers, follow-ups and real code — plus coding challenges and a last-minute revision sheet. One-time payment, instant access.

⚡ Get the JavaScript Interview Kit → ₹299

Full kit

JavaScript Interview Kit · ₹299

Get it →