Classes are nice tools to use when programming with the object-oriented paradigm, as they hold internal state and give access to methods on the instances. In functional programming, having stateful objects is more harmful than helpful, and should be replaced by the use of pure functions.
class Polygon {
constructor(height, width) {
this.height = height;
this.width = width;
}
}
function polygon(height, width) {
return {
height: height,
width: width
};
}