ES6 introduced a new protocol for constructing instances, but its features (incl. new.target
) work in both classes and traditional functions. These are the differences between traditional functions and classes:
-
Traditional functions can’t make superconstructor calls via
super()
. That means that they are always base classes. In ES5, superconstructors are called as functions. -
The prototype of traditional functions and base classes is
Function.prototype
. The prototype of a derived class is its superclass. -
Classes can’t be function-called. An exception is thrown if you do.