JavaScript · Middle · Question 2 of 75

How do call, apply and bind differ from each other?

Explanation

fn.call(ctx, a, b) and fn.apply(ctx, [a, b]) invoke immediately with the given this. fn.bind(ctx, a) returns a function with a permanently bound context and partially applied arguments. None of them affect arrow functions: they have no own this.

Further reading

Problem with a question

JavaScript · Middle · question 2

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz