Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Created December 18, 2015 01:45
Show Gist options
  • Select an option

  • Save blizzarddreams/460f35a3c1ac3fea1db9 to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/460f35a3c1ac3fea1db9 to your computer and use it in GitHub Desktop.
// 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