Class Inheritance in JavaScript

Class Inheritance in JavaScript

//Inheritance from ourselves

class Thinker {
    constructor(name, thought) {
        this.name = name
        this.thought = thought
    }
    display() {
        console.log(this.name)
    }
}

class Doer extends Thinker {
    constructor(name, thought, active) {
        super(name, thought)
        this.action = active
    }
    display() {
        console.log(this.thought)
    }
}

class Achiever extends Doer {
    constructor(name, thought, active, gain) {
        super(name, thought, active)
        this.gain = gain
    }
    display() {
        console.log(this.gain)
    }
}

let ram = new Achiever("Ram","I think I can do it",
    "I am doing it by hard work", "I did it successfully")
console.log(ram)