JS
challenger
Home
Intermediate JavaScript
classes
Add a Getter for a Computed Property
Add a Getter for a Computed Property
The class
Rectangle
stores a
width
and a
height
. Add a getter
area
that returns the width multiplied by the height. The getter should be callable like a property:
rect.area
.
Premium
reset
function greet(name) { return `Hello, ${name}!`; } console.log(greet("Erik"));
JavaScript
Run Code
Console