Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Use rectangle class to find the area of Square.
class Rectangle {
constructor(w, h) {
this.w = w;
this.h = h;
}
}
// Rectangle class Method to find the area.
Rectangle.prototype.area = function() {
return(this.w*this.h);
};
class Square extends Rectangle {
constructor(s) {
super(s);
this.h = s;
this.w = s;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment