Home
← All questions

Call, apply, bind and their polyfills in JavaScript

MediumPremiumJavaScript

Asked at Microsoft

JavaScript interview practice: Explain call/apply/bind and implement polyfills for each.

Answer

  • call(ctx, ...args) — invoke now with explicit this and individual args.
  • apply(ctx, argsArray) — same, args as array.
  • bind(ctx, ...args) — returns a new function permanently bound to ctx.
Premium question

Unlock the in-browser editor, test cases, and model solution with Mentoxis Premium.

Unlock with Premium