class Lannister { | |
dieNext() { | |
const victim = [ | |
'Tyrion', | |
'Cersei', | |
'Jamie' | |
]; | |
console.log(`${this.name} is going to kill ${victim[Math.floor(Math.random() * victim.length)]}!`); | |
} | |
constructor(data) { | |
this.name = data.name; | |
this.father = data.father; | |
this.hairColor = data.hairColor; | |
} | |
} | |
let Joffrey = new Lannister({ name: 'Joffrey', father: 'Jamie' }); | |
Joffrey.dieNext(); //Joffrey is going to kill Jamie! 😱 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment