Defines a getter on a class prototype
name of the property
getter function
Optional
target
class Rectangle { constructor(width, height) { this.width = width; this.height = height; }}definePrototypeGetter(Rectangle, 'area', function() { return this.width * this.height;});const rect = new Rectangle(5, 3);console.log(rect.area); // 15 Copy
class Rectangle { constructor(width, height) { this.width = width; this.height = height; }}definePrototypeGetter(Rectangle, 'area', function() { return this.width * this.height;});const rect = new Rectangle(5, 3);console.log(rect.area); // 15
Defines a getter on a class prototype