Answers for "how to define the few properties of a class in javascript"

0

how to define the few properties of a class in javascript

// unnamed
let Rectangle = class {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }
};
console.log(Rectangle.name);
// output: "Rectangle"

// named
let Rectangle = class Rectangle2 {
  constructor(height, width) {
    this.height = height;
    this.width = width;
  }
};
console.log(Rectangle.name);
// output: "Rectangle2"
Posted by: Guest on March-21-2022

Code answers related to "how to define the few properties of a class in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language