Posting the following code into the Babel REPL
class Test {
}
class Test2 extends Test {
}
you get this inherits
function
The setPrototypeOf
does set the [[prototype]] of subClass
from its original value Function.prototype
to superClass
, to let it inherit static properties from it.
Object.create
cannot be used here (like it is for the .prototype
object), as it does not allow to create functions. The constructor of a class has to be a function though, obviously; and the only way to do that is to create functions using standard expressions/declarations and then change its prototype afterwards.