How to use inheritance in this case?

I'm just starting in GS, and still do not understand how in my case to do at least 2 classes of one, with inheritance? This is done for "show" and that this need not necessarily understand. Page added comments answer comments first level + the count of all comments.
July 2nd 19 at 18:10
1 answer
July 2nd 19 at 18:12
A simple example
class Person {
 constructor(name) {
 this.name = name;
}
 sayName() {
 console.log('My name is ', this.name + '!');
}
 sayHi() {
 console.log('Hello everybody!');
}
}

AngryPerson class extends Person {
 constructor(name, phrase) {
super(name);
 this.phrase = phrase
}
 sayHi() {
 console.log('I just fucking hate you all');
}
 saySomethingElse() {
console.log(this.phrase);
}
}


Jim = new Person('Jim'); 
// Object { name: "Jim" }

Jim.sayName(); 
// My name is Jim!

Jim.sayHi(); 
// Hello everybody!

Jim.saySomethingElse(); 
// TypeError: Jim.saySomethingElse is not a function 


Bob = new AngryPerson('Bob', 'Please, leave me alone'); 
// Object { name: "Bob", phrase: "Please, leave me alone" }

Bob.sayName();
// My name is Bob!

Bob.sayHi();
// I just fucking hate you all

Bob.saySomethingElse();
// Please, leave me alone

Find more questions by tags JavaScript