Patterns for Object Inheritance in JavaScript ES2015

0
8
views

With the long-awaited arrival of ES2015 (formerly known as ES6), JavaScript is equipped with syntax specifically to define classes. In this article, I’m going to explore if we can leverage the class syntax to compose classes out of smaller parts. Keeping the hierarchy depth to a minimum is important to keep your code clean. Being smart about how you split up classes helps. For a large codebase, one option is to create classes out of smaller parts; composing classes. It’s also a common strategy to avoid duplicate code. Imagine we’re building a game where the player lives in a world…
Patterns for Object Inheritance in JavaScript ES2015