JSFiddle - React, Tailwind, and code Playground

by Marcio Mazzucato

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());