• + 0 comments
    Rectangle.prototype.area=function(){
        return this.w*this.h;
    }
    
    class Square extends Rectangle{
    //The super() method refers to the parent class.
    // By calling the super() method in the constructor method, we call the parent's constructor method and gets access to the parent's properties and methods.
        constructor(width){
            super(width,width);
            this.width=width;
        }
    }