Skip to content

Instantly share code, notes, and snippets.

@dengjonathan
Last active September 28, 2016 02:42
Show Gist options
  • Save dengjonathan/3d16d33332f3b20601c1e1dc9da20961 to your computer and use it in GitHub Desktop.
Save dengjonathan/3d16d33332f3b20601c1e1dc9da20961 to your computer and use it in GitHub Desktop.
Functional style through composition
class Animal {
constructor(name, legs) {
this.name = name;
this.legs = legs;
}
}
class Dog extends Animal {
constructor(name) {
super(name, 4)
}
}
var fido = new Dog('Fido');
console.log(fido.legs) //4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment