Answers for "Javascript Class expressions"

0

Javascript Class expressions

// 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 "Javascript Class expressions"

Code answers related to "Javascript"

Browse Popular Code Answers by Language