How to Handle JavaScript this Questions in Interviews
JavaScript this keyword interview questions explained: the 5 binding rules, call vs apply vs bind, and predict-the-output traps that reject freshers.

Why Indian Interviewers Keep Asking About this
Scroll through any frontend or full-stack JavaScript job posting on Naukri and you will see the same line: "strong JavaScript fundamentals." In technical rounds — from mass-recruiter campus placements to product startup interviews in Bengaluru and Hyderabad — one fundamental gets probed more than any other: the this keyword. It rarely comes as a theory question. You get five lines of code on a screen or a whiteboard and one instruction: what does this print? Most freshers freeze right there.
The good news: this follows a small set of rules. Learn the rules and the priority order, and almost every question becomes mechanical.
The 5 Binding Rules Interviewers Test
As MDN documents, this is decided at call time, not at definition time. There are five cases to know:
- Default binding: a plain call like
foo(). In non-strict modethisis the global object; in strict mode it isundefined. - Implicit binding: an object before the dot. In
obj.greet(),thisisobj. - Explicit binding:
call,apply, orbindsetthisdirectly. - New binding:
new Foo()creates a fresh object and pointsthisat it. - Arrow functions: no
thisof their own — they inherit it from the surrounding scope, per MDN's arrow function guide.
When more than one rule could apply, the priority is: new > bind > call/apply > implicit > default. Arrow functions sit outside this list entirely.
call vs apply vs bind — The Follow-Up Behind Every Question
All three set this explicitly. The differences interviewers want:
call— invokes immediately, arguments passed one by one.apply— invokes immediately, arguments passed as an array.bind— does not invoke; returns a new function withthispermanently fixed.
Then comes the classic follow-up: can you override a bound function's this with a second bind or a call? No. Only the first bind sticks, and new is the single exception that beats it.
4 Predict-the-Output Traps That Reject Freshers
1. The detached method
const obj = {
x: 10,
foo() { console.log(this.x); }
};
const fn = obj.foo;
fn(); // undefined — plain call, default binding
Assigning obj.foo to a variable strips the object context. Fix it with obj.foo.bind(obj) or call it as obj.foo().
2. setTimeout losing this
const user = {
name: "Priya",
show() {
setTimeout(function () {
console.log(this.name);
}, 0);
}
};
user.show(); // undefined
The callback is a plain call, so default binding applies. Swap the regular function for an arrow function and this is inherited from show — it prints "Priya".
3. Arrow functions ignore call, apply and bind
Passing a thisArg to .call() or .bind() on an arrow function is silently ignored. Arrow functions take their this from where they are written — nothing at the call site changes it.
4. new beats bind
function User(name) { this.name = name; }
const BoundUser = User.bind({ name: "ignored" });
const u = new BoundUser("Rahul");
console.log(u.name); // "Rahul"
new has the highest priority, so the hard-bound object is discarded.
How to Actually Prepare
Reading the rules is not the same as applying them under pressure. Three steps that work:
- Write each rule as a 3-line snippet and predict the output before running it.
- Work through 10-15 predict-the-output problems — freeCodeCamp's guide to the this keyword covers the same traps Indian interviewers ask.
- Say your reasoning out loud in a mock interview — the "why" matters as much as the answer.
For the broader question set, our JS interview questions for Indian freshers covers closures, hoisting and promises, which pair naturally with this. And since the resume is what gets you the technical round in the first place, build it with an ATS-friendly tool like the PrepFox resume builder.
A 30-Second Checklist for Any this Question
- Arrow function? Lexical
this— done. - Called with
new?thisis the new object. call,applyorbindpresent? Explicit wins.- Object before the dot? Implicit binding.
- None of the above? Default — global object, or
undefinedin strict mode.
Answer in that order and you will handle nearly every this question thrown at you — whether it arrives inside React class components, event handlers, or a bare five-line snippet.
Ready to put this into practice?
Practice mock interviews, build your resume, and get expert feedback — all on PrepFox.
More from PrepFox Blog
How to Crack Aptitude Interview Questions in Placements
How to crack aptitude interview questions in Indian placements: quant, reasoning and verbal sections, an 8-week plan, and test-day strategy.
9 Questions to Ask the Interviewer That Impress HR
Interview questions to ask the interviewer: 9 smart questions that impress Indian HR, what each one signals, and what never to ask in round one.
How to Answer Civil Interview Questions as a Fresher
How to answer civil interview questions as a fresher in India: slump test, foundations, cement tests and salary data for site engineer offers.
