Skip to content

Instantly share code, notes, and snippets.

@Retsam
Last active August 29, 2015 14:25
Show Gist options
  • Save Retsam/649cc922b61b110c85d2 to your computer and use it in GitHub Desktop.
Save Retsam/649cc922b61b110c85d2 to your computer and use it in GitHub Desktop.
BabelJS Bug
//Expected output: A B C (see http://www.es6fiddle.net/ice1qchm/)
//Actual output from Babel: A C
//ES5 legacy code
function A () {
console.log("A");
}
function B () {
A.call(this);
console.log("B");
}
B.prototype = Object.create(A.prototype);
B.constructor = B;
//ES6 code
class C extends B {
constructor(data) {
super({}); //Should call B(), no?
console.log("C");
}
}
new C();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment