3 ms·
> what (generic) code is `super` syntactic sugar for? super.propertyOnSuper ~= this.__proto__.propertyOnSuper super() in constructor ~= ParentConstructor.
by secoif 11y ago
> what (generic) code is `super` syntactic sugar for?
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/3af5a10c6b51f9e99d9f90394645d7ea630d5eaa/inherits_browser.js#L17 https://github.com/isaacs/inherits/blob/3af5a10c6b51f9e99d9f...
- djacobs 11y agoThanks for the response. If the choice is between manually specifying that (type of) code for every kind of object (and likely moving to a #create factory method) or using a native syntax for class declaration, I can see why people would choose the latter.