Introduction

In the previous chapter, we saw how to use the new class syntax to implement behavior that was only slightly more difficult to implement directly with a prototype. A developer could be excused for thinking that this complexity of the language was not worth it. After all, it's only a line (or perhaps a character) or two extra to get the same behavior.

The real advantage of using the new ES6 class syntax to create object prototypes is revealed when more complicated structures and techniques are used. In essence, we'll see that it's much easier to understand code when the behavior is defined with keywords, rather than context-sensitive operators.

In this chapter, we'll look at how to implement some more sophisticated behaviors using ...

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.