How to overload constructors in JavaScript ECMA6? [duplicate]
There is no in-built solution for this in JavaScript. An alternative solution can be using the arguments object (in some cases), or passing your own configuration options, similar to this: const defaults = { numberWheels: 4, color: “black”, name: “myCar” } class Car { constructor(options) { this.wheelsNum = options.numberWheels || defaults.numberWheels; this.name = options.name || … Read more