Another way of wiring up such prototype linkages served as the (honestly, ugly) predecessor to the elegance of the ES6 system (see Chapter 2, “Classes”), and is referred to as prototypal classes.

    Let’s first recall the Object.create(..) style of coding:

    The prototypal class pattern would have labeled this delegation behavior “inheritance,” and alternatively have defined it (with the same behavior) as:

    All functions by default reference an empty object at a property named . Despite the confusing naming, this is not the function’s prototype (where the function is prototype linked to), but rather the prototype object to link to when other objects are created by calling the function with new.

    Then new Classroom() creates a new object (assigned to ), and prototype links it to the existing Classroom.prototype object.

    Though mathClass does not have a welcome() property/function, it successfully delegates to the function Classroom.prototype.welcome().

    Under the covers, the same prototype linkage is wired up, but this syntax fits the class-oriented design pattern much more cleanly than “prototypal classes”.