Skip to solution
mediumFrontend

What is the difference between call, apply, and bind?

800 views
01

Understand the problem

Question presented to candidate: "What's the actual difference between call, apply, and bind — not just how their arguments are formatted, but what each one actually DOES to the function?"

What a strong answer should cover:

  • 📌 Interview term: fn.call(thisArg, arg1, arg2, ...) — invokes fn immediately, with this set to thisArg, passing the remaining arguments individually.
  • 📌 Interview term: fn.apply(thisArg, [arg1, arg2, ...]) — invokes fn immediately, identical to call, except the arguments are passed as a single array.
  • 📌 Interview term: fn.bind(thisArg, arg1, ...) — does not invoke fn at all; it returns a new function with this permanently locked to thisArg (and optionally some leading arguments pre-filled), to be called later.
  • 📌 Interview term: the real, direct distinguishing proof — verified directly: calling .call()/.apply() genuinely invoked the function immediately (a tracking flag flipped to true synchronously), while calling .bind() genuinely left that same flag false until the returned bound function was separately, explicitly called.
  • A precise answer names that once a function is bound, its this genuinely cannot be overridden by a later .call(), .apply(), or even another .bind() — verified directly, the original bound this stayed in place through both override attempts — and that arrow functions ignore all three methods' this argument entirely, since arrow functions have no this of their own to rebind.

Clarifying questions expected:

  • None — this is a definitional/comparison question; correctly distinguishing "invokes immediately" (call/apply) from "returns a new function for later" (bind) is the strong signal, beyond the argument-formatting difference most candidates already know.

Code / implementation expected: Yes — demonstrating the immediate-invocation vs. deferred-invocation distinction directly (not just the argument format) is the most convincing proof of real understanding.

call-apply-bind
02

Attempt it yourself

Sketch your approach before reading the solution — that's what interviews test.

Nudge consolestandby

Stuck? Beam a request up — the console returns a conceptual nudge that guides your logic without spoiling the implementation.

03

Study the solution

Target Audience: Engineers preparing for JavaScript fundamentals interviews. Difficulty: Medium

How to read this doc: Concepts are explained in plain language first, then tagged with 📌 Interview term:. Every timing and this-binding claim below was actually run in Node.

1. Why This Even

Solution ready — 2 min read

Classified // press E to declassify

04

Run the code

JSReal proof: call/apply invoke immediately, bind returns a new function, and a bound this cannot be overridden
05

Join the discussion

Discussion (0)

Sign in to join the discussion.

No responses yet. Be the first to share what you think.

Transmission complete // awaiting log

KEEP THE
STREAK ALIVE.

Dossier 65 of 165 decoded in the JavaScript track. One more won't hurt.

Back to track