As the output of 6to5 I\'ve got the following code:
var _inherits = function (subClass, superClass) {
if (typeof superClass !== \"function\" && super
Can anybody describe what for used updating
__proto__
property?
ES6 specs that when classes inherit from each other, the resulting constructor functions should inherit from each other as well. CoreController.isPrototypeOf(Controller)
will yield true
.
As i try - it doesn't nothing useful
It is very useful for inheriting static properties, which are placed on the constructor functions in JS.
CoreController.hi = console.log.bind(console, "hello world");
CoreController.hi(); // hello world
Controller.hi(); // error
_inherits(Controller, CoreController);
Controller.hi(); // hello world
documentation says that proto should be object, but in code is used for setting function
Every function is an object in JS. It has a prototype, and it can serve as one.