Created
September 11, 2018 14:28
-
-
Save patrickporto/c124ce5e291d65e4d4ca96953a973a7c to your computer and use it in GitHub Desktop.
Classes (EcmaScript 6)
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 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