DEV Community

Discussion on: Truly Understand Bind, Call & Apply

Collapse
 
pris_stratton profile image
pris stratton

Nice. Definitely important functions to understand. My understanding of how prototypal β€œinheritance” works is that call is used when an object calls function from further up the chain, does that sound about right?

Collapse
 
bhagatparwinder profile image
Parwinder πŸ‘¨πŸ»β€πŸ’»

I would say the method is called when you are not adjacent or you are detached from the method you are calling.

call serves an extremely important purpose of running a method under a context you provide.

This means that we can call any function, explicitly specifying the reference that this should reference in the calling function.

Collapse
 
pris_stratton profile image
pris stratton • Edited

I guess what I am getting it as if you had an array called xs and you called map on that array, would you in effect be calling Array.prototype.map.call(xs,function)? Since map doesn’t belong to xs. I know I am being very specific here πŸ˜ƒ