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?
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 π
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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?
I would say the method is
call
ed when you are not adjacent or you are detached from the method you arecall
ing.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.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 π