JSFiddle - React, Tailwind, and code Playground
JavaScript
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
calcArea() {
return this.height * this.width;
}
}
Square = new Polygon(10, 10);
alert(Square.calcArea());