Skip to content

Instantly share code, notes, and snippets.

@jsatk
Created January 17, 2018 00:30
Show Gist options
  • Select an option

  • Save jsatk/ec654f73e7af88f0818d7ee5217facbc to your computer and use it in GitHub Desktop.

Select an option

Save jsatk/ec654f73e7af88f0818d7ee5217facbc to your computer and use it in GitHub Desktop.
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