Last active
September 28, 2016 02:42
-
-
Save dengjonathan/3d16d33332f3b20601c1e1dc9da20961 to your computer and use it in GitHub Desktop.
Functional style through composition
This file contains 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
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