JavaScript inheritance is always the same mechanism: an object's [[Prototype]] link, followed on property lookup. Constructors and classes reach it indirectly — new F() runs OrdinaryCreateFromConstructor, which creates an object linked to F.prototype. Delegation style reaches it directly: behaviour objects are plain objects, and you link to them with Object.create(proto) or { __proto__: proto }. Kyle Simpson's You Don't Know JS calls this "OLOO", objects linked to other objects.
A delegation-style "type" is just an object with methods. Instead of a constructor, it has an ordinary init method that sets fields and returns this, so creation reads Object.create(Square).init(3). A "subtype" is an object whose prototype is the parent object, and concise methods get a [[HomeObject]], so super.init() works in them.
How it compares with classes:
- Same chain, fewer moving parts. There's no
.prototypeproperty, noconstructorback-link to keep right, and no "forgotnew" bug. - Type checks change.
instanceofneeds a callable right-hand side with aprototype(OrdinaryHasInstance), sox instanceof Squarethrows a TypeError whenSquareis a plain object. UseSquare.isPrototypeOf(x)instead.x.constructoris just the inheritedObject. - Methods are enumerable. Object-literal methods show up in
for…inon every instance; class methods don't. - Class-only features. Private
#fieldsexist only inclassbodies, and subclassing built-ins likeArrayorErrorwith their internal slots needs a constructor call (class … extendsandnew, orReflect.construct). - Familiarity. Most codebases, frameworks and tools expect classes, so delegation style is a team decision, not a free upgrade.
In practice: classes for most modelled types, delegation when you want behaviour shared among a few objects without ceremony, and composition (objects holding collaborators) when inheritance isn't really the relationship.