es6 classes and constructor classes 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');