I take a look at the following code and have a bad feeling that the older version was much simpler to do.
// Pre ES6: 5 lines
function Car (make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
// Post ES6: 7 lines
class Car {
constructor(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
}
}
They are both objects at the end of the day. So, why should we use the new construct?