Skip to content

Instantly share code, notes, and snippets.

@indexzero
Last active September 27, 2016 18:31
Show Gist options
  • Save indexzero/c7ff21dcb61eacae2bebaf0a12e3b801 to your computer and use it in GitHub Desktop.
Save indexzero/c7ff21dcb61eacae2bebaf0a12e3b801 to your computer and use it in GitHub Desktop.
Implicit constructors do call super() in ES6 classes
'use strict';
class AbstractClass {
constructor() {
this.foo = 'foo';
}
}
class DerivedClass extends AbstractClass {
getFoo() {
console.log(this.foo);
}
}
let der = new DerivedClass();
der.getFoo();
$ node extends.js
foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment