Category "prototypal-inheritance"

Dynamically extending a class in javascript

How can we dynamically/programmatically extend a javascript class? More concretely, given something like class Polygon { constructor(area, sides) { thi

__proto__ VS. prototype in JavaScript

This figure again shows that every object has a prototype. Constructor function Foo also has its own __proto__ which is Function.prototype, and which in turn a