☑️ Topic: Classes
☑️ Idea: ES6 is better than ES5 for readable class inheritance, construction and methods.
☑️ Benefits: Readability, Maintainability.
☑️ Guideline: Use small functions when you need something simple and use ES6 classes when you need larger and more complex objects.
// BAD const Animal = function(age) { if (!(this instanceof Animal)) { throw new Error("Instantiate Animal with `new`"); } this.age = age; }; Animal.prototype.move = function move() {}; // GOOD class Animal { constructor(age) { this.age = age; } move() {/* ... */} }