js call function in class constructor code example
Example: ES6: Use class Syntax to Define a Constructor Function
class Vegetable {
constructor(name) {
this.name = name;
}
}
const carrot = new Vegetable('carrot');
class Vegetable {
constructor(name) {
this.name = name;
}
}
const carrot = new Vegetable('carrot');