Exploring ECMAScript 2015
We have already used many of the new features of ES2015 throughout this book, such as arrow functions, template strings, and promises. We have also already seen ES2015's syntax for classes in Chapter 3, A JavaScript Primer.
ES2015 is a major update to the language, including many new features and syntax improvements. This section will cover some of the other useful improvements that we haven't seen so far in the book. For complete coverage of everything new in ES2015, see the excellent Exploring ES6, available at http://exploringjs.com/es6/.
Understanding ES2015 modules
As mentioned in previous chapters, ES2015 introduces a new module specification. Recall from Chapter 4, Introducing Node.js Modules, that each module system provides the following:
- A way of declaring a module with a name and its own scope
- A way of defining functionality provided by the module
- A way of importing a module into another script
Modules are scoped to their containing file, as in CommonJS...