classes - mmedrano9438/peripheral-brain GitHub Wiki

Classes are a template for creating objects. They encapsulate data with code to work on that data.

// Declaration class Rectangle { constructor(height, width) { this.height = height; this.width = width; } }

// Expression; the class is anonymous but assigned to a variable const Rectangle = class { constructor(height, width) { this.height = height; this.width = width; } };

// Expression; the class has its own name const Rectangle = class Rectangle2 { constructor(height, width) { this.height = height; this.width = width; } };