Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
class Shape { #area = 0; constructor(color) { this.color = color; } get info() { return `${this.color} shape`; } static create(c) { return new Shape(c); } } class Circle extends Shape { constructor(r, c) { super(c); this.#area = Math.PI * r * r; } get area() { return this.#area; } }
Result
Open