But JS, I know you’re lying to me. You really don’t have classes like in other OOP (object oriented programming) languages.
That’s basically what’s happening when you create a shiny new object out of a constructor function (using the “new” keyword). Prototypes are the mechanism where JS objects inherit features from each other. Inheritance always comes via an object and that’s where the methods and properties are inherited from. If you look in your code, you’ll notice that each of the inherited objects has a property called “__proto__” that points to the original prototype object that it was created from.
A prototype chain is just a linked list. One object has a link inside it connected to another prototype object that has a link inside it. When you use the constructor function with the “new” keyword, you’re basically just creating an object with a default property prototype and linking it to other prototype objects.
So perhaps naming constructor functions as classes through ES6 was just a way to placate the developers coming from other OOP languages. After all, classes sounds a lot more sexy than prototype chains.