Skip to content

Instantly share code, notes, and snippets.

@Neptune998
Last active August 8, 2020 16:32
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Neptune998/ef1c2ba5c99c433f35ea29d689fb7990 to your computer and use it in GitHub Desktop.
// 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