#11) Explain call(), apply() & bind() ❓

?call()

✔The call() method calls a function with a given this value and arguments provided individually.
✔call() method allows object to use method/function of another object.
✔call() accepts arguments.

?apply()

✔It is similar …


This content originally appeared on DEV Community and was authored by Mayank Yadav

?call()

✔The call() method calls a function with a given this value and arguments provided individually.
call() method allows object to use method/function of another object.
call() accepts arguments.

image

?apply()

✔It is similar to call() method but call() method takes argument separately whereas in apply() method arguments are passed as an array.

image

?bind()

✔It creates a new function and when invoked has the this keyword set to the provided value.
image
✔In case of call() & apply() the function is immediately called but in case of _bind() it does not call in-fact it just return another function which you can call it later.
That's why in above example I've stored the value in a variable fun and then invoked it.


This content originally appeared on DEV Community and was authored by Mayank Yadav


Print Share Comment Cite Upload Translate Updates
APA

Mayank Yadav | Sciencx (2021-07-31T15:13:42+00:00) #11) Explain call(), apply() & bind() ❓. Retrieved from https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/

MLA
" » #11) Explain call(), apply() & bind() ❓." Mayank Yadav | Sciencx - Saturday July 31, 2021, https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/
HARVARD
Mayank Yadav | Sciencx Saturday July 31, 2021 » #11) Explain call(), apply() & bind() ❓., viewed ,<https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/>
VANCOUVER
Mayank Yadav | Sciencx - » #11) Explain call(), apply() & bind() ❓. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/
CHICAGO
" » #11) Explain call(), apply() & bind() ❓." Mayank Yadav | Sciencx - Accessed . https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/
IEEE
" » #11) Explain call(), apply() & bind() ❓." Mayank Yadav | Sciencx [Online]. Available: https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/. [Accessed: ]
rf:citation
» #11) Explain call(), apply() & bind() ❓ | Mayank Yadav | Sciencx | https://www.scien.cx/2021/07/31/11-explain-call-apply-bind-%e2%9d%93/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.