by Touche · 10y ago · 0 comments
function Foo() {
}
Foo.prototype = Object.create(Parent.prototype);
....
It's just sugar, nothing more.EDIT: Just tested in Firefox and indeed you can.
Even if it is just syntactic sugar, that syntactic sugar makes it much more approachable for devs who want to use classical inheritance (not that I'd encourage that).
super.propertyOnSuper ~= this.__proto__.propertyOnSuper
super() in constructor ~= ParentConstructor.call(this)
and some tools provide such things like this.super_:https://github.com/isaacs/inherits/blob/3af5a10c6b51f9e99d9f...