Created
April 1, 2019 18:39
-
-
Save raduGaspar/52297cfdb77f1c2dbf2c8e506928d772 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 | |
} | |
fly () { | |
return 'I can fly' | |
} | |
} | |
const sg = new SuperGirl('Kara', 'Zor-El', 1554143709, [ | |
'flying', 'heat vision', 'strength' | |
]) | |
console.log(sg.sayHello(), sg.fly()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment