Created
December 1, 2018 22:44
-
-
Save manekinekko/780a57634f0393301f718c4b3f8eea0d 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
class Force { | |
constructor(name = 'Force'){ | |
this.me = name; | |
} | |
print(){ | |
return `${this.me} Force`; | |
} | |
} | |
class Jedi extends Force { | |
constructor(name = 'Jedi'){ | |
super(); | |
this.me = name; | |
} | |
print(){ | |
return `${this.me} POWA!!`; | |
} | |
} | |
const yoda = new Jedi('Yoda'); | |
console.log(yoda instanceof Jedi); //=> true | |
console.log(yoda instanceof Force); //=> true | |
console.log(yoda.print()); //=> Yoda POWA!! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment