Last active
September 27, 2016 18:31
-
-
Save indexzero/c7ff21dcb61eacae2bebaf0a12e3b801 to your computer and use it in GitHub Desktop.
Implicit constructors do call super() in ES6 classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
class AbstractClass { | |
constructor() { | |
this.foo = 'foo'; | |
} | |
} | |
class DerivedClass extends AbstractClass { | |
getFoo() { | |
console.log(this.foo); | |
} | |
} | |
let der = new DerivedClass(); | |
der.getFoo(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ node extends.js | |
foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment