Intermediate
JavaScript
Q46 / 100
What is the difference between call(), apply(), and bind()?
Correct! Well done.
Incorrect.
The correct answer is B) call() invokes immediately with individual args; apply() invokes immediately with args array; bind() returns a new function with this fixed
B
Correct Answer
call() invokes immediately with individual args; apply() invokes immediately with args array; bind() returns a new function with this fixed
Explanation
f.call(ctx, a, b), f.apply(ctx, [a, b]) invoke f with ctx as this. f.bind(ctx, a) returns a new function with this permanently set.
Progress
46/100