class declaration in javascript

JavaScript
class Rectangle {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }
  // Getter
  get area() {
    return this.calcArea();
  }
  // Method
  calcArea() {
    return this.height * this.width;
  }
}

const square = new Rectangle(10, 10);

console.log(square.area); // 100class Car {
  constructor(brand) {
    this.carname = brand;
  }
}class NameOfClass {
//class declaration first letter should be capital it's a convention
  obj="text";
  obj2="some other text";
}
//always call class with "new" key word
console.log(new NameOfClass);class myClass {
// thats all I know so check another grepper answer for the rest
}
Source

Also in JavaScript: