Skip to content

Instantly share code, notes, and snippets.

@patrickporto
Created September 11, 2018 14:28
Show Gist options
  • Save patrickporto/c124ce5e291d65e4d4ca96953a973a7c to your computer and use it in GitHub Desktop.
Save patrickporto/c124ce5e291d65e4d4ca96953a973a7c to your computer and use it in GitHub Desktop.
Classes (EcmaScript 6)
class Person {
constructor(name) {
this.name = name;
}
saysHello() {
return "Hello, my name is " + this.name;
}
}
class Employee extends Person {
constructor(name, title) {
super.constructor(name);
this.title = title;
}
describe() {
return super.saysHello() + " (" + this.title + ")";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment