+ 1
Is constructor overloading possible
class Rectangle { constructor(height, width) { this.height = height; this.width = width; } get area() { return this.calcArea(); } calcArea() { return this.height * this.width; } } const square = new Rectangle(5, 5); console.log(square.area); // 25 Here if we add another constructor with only one attribute will it do constructor overloading like in c++
1 Resposta
+ 3
Javascript doesn't support function or construct overloading.