class Size {
constructor(width, height) {
this.width = width;
this.height = height;
}
}
Object.defineProperty(Size.prototype, "area", {
get: function area() {
return this.width * this.height;
}
});
let size = new Size(4, 5);
let area = size.area;
//area is 20
console.log(`area is ${area}`);