Some important concepts every JS developer should know — just don’t let the lingo scare you.
Two questions to determine how useful this article will be for you:
Can you explain how JS handles prototypal inheritance by explaining the difference between the prototype property, prototype object vs. object prototype, and the prototype concept in general? Do you get it when I say that
call both bind, but
bind just binds while
call also calls?
Let’s start with
First some background: what is
this? Execution context, the environment/place/scope in which a function executes.
this may be determined implicitly, in which case
this can get ‘lost’ and lose the execution context we would expect it to have. When that happens there are a number of options to correct the issue, and one such option is to explicitly set, or 'bind’,
this to the appropriate context.
Next, prototypes. Ah, OOP in JS — a unique phenomenon in OOP land.
In good old regular English, a prototype is something we use to make other things in its image. Those new things inherit from the prototype’s traits and characteristics. Another way of referring to this relationship is a parent vs. child object.