JSFiddle - React, Tailwind, and code Playground
JavaScript
class Square {
constructor(height, width) {
this.name = 'Square';
this.height = height;
this.width = width;
}
sayStructure() {
console.log('Hi, I am a ', this.name + '.');
}
defineLook() {
alert(this.name +' has four side with equal length.');
}
}
let p = new Square(300, 300);
p.defineLook();
console.log('The width of this polygon is ' + p.width);