Part 2. Understanding functions
Now that you’re mentally prepared and you understand the environment in which JavaScript code is executed, you’re ready to learn the fundamentals of the JavaScript features available to you.
In chapter 3, you’ll learn all about the most important basic concept of JavaScript: no, not the object, but the function. This chapter will teach you why understanding JavaScript functions is the key to unlocking the secrets of the language.
Chapter 4 continues our in-depth exploration of functions by studying how functions are invoked, alongside all the ins and outs of implicit parameters that are accessible when executing function code.
Chapter 5 takes functions to the next level with closures—probably one of the most misunderstood (and even unknown) aspects of the JavaScript language. As you’ll soon see, closures are closely tied to scopes. In this chapter, in addition to closures, we put a special focus on the scoping mechanisms in JavaScript.
Our exploration of functions will be completed in chapter 6, where we discuss a completely new type of function—the generator function—that has some special properties and is especially useful when dealing with asynchronous code.