HomePremium · ₹1199
← All questions

Call, apply, bind and their polyfills

Medium
Was this asked in an interview?

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.
Call, apply, bind and their polyfills — JavaScript Interview Question | Mentoxis