Summary
In this chapter, we introduced and discussed some of the modern JavaScript syntax introduced in ECMA 6. We first considered the difference between let
and var
and discussed why let
is the preferred method for initializing variables. Following that, we discussed destructuring, the spread operator, scopes, and also closures. We then went on to introduce some important methods of arrays, objects, and strings. Following that, we talked about arrow functions, including their advantages over traditional functions, and then we moved on to discuss JavaScript promises and async/await.
We then looked briefly at OOP concepts and support in JavaScript with examples showing how to write classes. We also learned how to set up a modern JavaScript environment with transpiling and bundling support using tools such as Babel and webpack. Finally, we introduced unit testing using Mocha and the Chai library.
In the next chapter, we will introduce Dnotebook, an interactive computing environment that enables quick and interactive experimentation in JavaScript.