DEV Community

Cover image for Understand call, apply, and bind functions in JavaScript like never before.

Understand call, apply, and bind functions in JavaScript like never before.

Swastik Yadav on September 23, 2022

In this post, we'll take a detailed look at how call, apply, and bind work in JavaScript. JavaScript's call(), apply(), and bind() functions are o...
Collapse
 
mrcaidev profile image
mrcaidev •

Well explained! Thanks!

Collapse
 
swastikyadav profile image
Swastik Yadav •

Thank you Yuwang.

Collapse
 
wushang1987 profile image
Will Wang •

very clear, Thanks

Collapse
 
swastikyadav profile image
Swastik Yadav • • Edited

You are welcome. 😊

Collapse
 
philldev profile image
Deddy Wolley •

Very easy to understand thanks!

Collapse
 
swastikyadav profile image
Swastik Yadav •

Thank you for your words. I'm Glad that you found this useful.

Collapse
 
leeuw profile image
leeuw •

thanks!

Collapse
 
janiththilakarathna profile image
Janith Thilakarathna •

Simple & concise... Thank you...

Collapse
 
swastikyadav profile image
Swastik Yadav •

Thank you Janith, I am glad that you found this useful.

Collapse
 
arunran30008245 profile image
arun rana •

Hey so whats that bind fn inside in react ' s class components's constructor ?

Collapse
 
swastikyadav profile image
Swastik Yadav •

Hi Arun,

That binding of methods (event handlers) in React class component is exactly the bind method which is explained in this post.

You can use arrow functions in class component to avoid this binding, because arrow functions don't have their own "this" binding.