Answers for "call() vs apply() vs bind()"

1

call() vs apply() vs bind()

Differentce between .bind() , .call() and .apply()

.bind(someobj) -> does not invoke the function, it just allows you to 
bind whatever object you want, you have to call the function yourself.

.call(someobj) and .apply(someobj)-> both invoke the function 
immediately,and modify the context. 
The only difference is how you pass your
own arguments. See below

.call(someobj, param1, param2)
.apply(someobj, [param1, param2]) //uses array to pass the args
Posted by: Guest on March-25-2020

Code answers related to "call() vs apply() vs bind()"

Code answers related to "Javascript"

Browse Popular Code Answers by Language