JavaScript’s OOP English-isms

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 bind and call both bind, but bind just binds while call also calls?


Let’s start with bind vs. call.

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.

In JavaScript’s prototypal inheritance paradigm, all (essentially all) objects inherit from another object. That parent object is called the object prototype (P) and it possesses a property called ‘prototype’ — this property is referred to as the prototype object (O), as it references/returns the object from which the child (C) inherits. So, O is both a property called ‘prototype’ and the parent object which serves as a prototype, in that it bequeathes all sorts of goodies to its inheritors. Note that O is the prototype, not the object on which O resides — that object is the object prototype. So, which is the parent — the object prototype or the prototype object? Depends on the context (relative, not execution), so long as you understand the details I explained above.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Zachary DuBow

wannabe Torah scholar, amateur stock market investor, junior web developer