Last active
April 1, 2019 19:12
-
-
Save raduGaspar/3ef54dabc39446e8090e676d4ec91625 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 Person { | |
constructor (firstName, lastName, birthday) { | |
this.firstName = firstName | |
this.lastName = lastName | |
this.birthday = birthday | |
} | |
sayHello () { | |
return `My name is ${this.firstName}` | |
} | |
} | |
class SuperGirl extends Person { | |
constructor (firstName, lastName, birthday, superpowers) { | |
super(firstName, lastName, birthday) | |
this.gender = 'female' | |
this.superpowers = superpowers | |
} | |
sayHello () { | |
return ` | |
My name is ${this.firstName} ${this.lastName}. Years ago, my planet, Krypton, was in serious peril. | |
My cousin, Kal-El, was sent to a planet called Earth for his own safety and protection. | |
You may know his story. The story you don't know is that I was sent to protect him. | |
` | |
} | |
fly () { | |
return 'I can fly' | |
} | |
} | |
const sg = new SuperGirl('Kara', 'Zor-El', 1554143709, [ | |
'flying', 'heat vision', 'strength' | |
]) | |
console.log(sg.sayHello()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment