Last active
August 8, 2020 16:32
-
-
Save Neptune998/ef1c2ba5c99c433f35ea29d689fb7990 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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