Created
January 17, 2018 00:30
-
-
Save jsatk/ec654f73e7af88f0818d7ee5217facbc 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
| class Rectangle { | |
| constructor(height, width) { | |
| this.height = height; | |
| this.width = width; | |
| } | |
| get area() { | |
| return this.height * this.width; | |
| } | |
| } | |
| // Pre-ES6 | |
| function Rectangle(height, width) { | |
| this.height = height; | |
| this.width = width; | |
| } | |
| Rectangle.prototype.getArea = function () { | |
| return this.height * this.width; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment