Skip to content

Instantly share code, notes, and snippets.

@raduGaspar
Last active April 1, 2019 19:12
Show Gist options
  • Save raduGaspar/3ef54dabc39446e8090e676d4ec91625 to your computer and use it in GitHub Desktop.
Save raduGaspar/3ef54dabc39446e8090e676d4ec91625 to your computer and use it in GitHub Desktop.
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