swc/crates/swc_estree_compat/tests/fixtures/class-getter-setter/input.js
Donny/강동윤 790a262c07
refactor(es/estree): Rename: babel => estree (#2846)
swc_babel_ast:
 - Rename as `swc_estree_ast`.

swc_babel_compat:
 - Rename as `swc_estree_compat`.

swc_babel_visit:
 - Rename as `swc_estree_visit`.
2021-11-24 05:34:41 +09:00

23 lines
400 B
JavaScript

class Rectangle {
constructor(height, width) {
this.height = height;
this.width = width;
}
set height(height) { this.height = height; }
set width(width) { this.width = width; }
get area() {
return this.calcArea();
}
calcArea() {
return this.height * this.width;
}
}
const square = new Rectangle(10, 10);
console.log(square.area);