Created
December 18, 2015 01:45
-
-
Save blizzarddreams/460f35a3c1ac3fea1db9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // ES6 way | |
| class Dog { | |
| constructor(name) { | |
| this.name = name; | |
| } | |
| bark() { | |
| console.log(`${this.name} goes bark!`); | |
| } | |
| } | |
| // ES5 way | |
| function Dog(name) { | |
| this.name = name; | |
| } | |
| Dog.prototype.bark = function() { | |
| console.log(`${this.name} goes bark!`); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment