JavaScript: Difference between revisions

No edit summary
Line 44: Line 44:
// To add to the prototype
// To add to the prototype
Object.assign(Rectangle.prototype, {
Object.assign(Rectangle.prototype, {
  constructor: Rectangle,
   getSize: function() {
   getSize: function() {
     return this.height * this.width;
     return this.height * this.width;