The answer
Use Array.prototype.slice.call(arguments) to borrow slice and convert the array-like arguments to a real array.
Use Array.prototype.slice.call(arguments) to borrow slice and convert the array-like arguments to a real array.
call and apply invoke immediately (call takes comma args, apply takes an array). bind returns a new function with this permanently bound, to be called later.
No. Arrow functions inherit this lexically. call, apply, and bind cannot change an arrow's this.
Presetting arguments: const add5 = add.bind(null, 5) creates a function where the first arg is always 5.
Browse all our FAQs or reach out to our support team
Your learning library
Find your next course. Build something great.
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success
Success