JSFiddle - React, Tailwind, and code Playground

JavaScript

class Square {
	
  constructor(width, height) {
  	this.width = width;
    this.height = height;
  }
  
  get surface() {
    return this.calcSurface();
  }
  
  calcSurface() {
  	return this.width * this.height;
  }
   
}

let square = new Square(100, 100);

document.write(square.surface);