call(), apply() and bind()
These three are the prototype functions of function.
call():
call() is used to invoke the function as same as the normal invoke.
using call prototype function we can barrow the function from the other objects.
apply():
apply() is used to invoke the function as same as the normal invoke, but the difference is we pass the arguments as object as first and remaining arguments passed as an array as second parameter where call has object as first and remaining with comma separator as same as in normal functions.
using apply prototype function also we can barrow the function from the other objects as call function.
bind():
bind is a prototype function of function that returns an function by appending that function to the another object passed in the argument.
it will not invoke the function as call and apply does.
It is used to fix the dynamic scoping that ruins the lexical scoping.
it takes the arguments as same as call.
Last updated