Created
September 28, 2016 02:43
-
-
Save dengjonathan/c64deffaab7e55ea4683f1c47014c3bd to your computer and use it in GitHub Desktop.
OOP style
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