So far in this book, we've only talked about topics that can be considered to relate to backend development. This means heavy PHP working with the APIs and the database, and so on. This is because this book is oriented toward module developers rather than "themers". Also, the author of this book is admittedly not a JavaScript, or any kind of frontend, developer.
Nevertheless, in this chapter we'll switch gears and talk a bit about frontend development, namely, how to work with JavaScript in a Drupal 8 application. This is because there are many things developers can and should be doing in their modules that require frontend technologies. There are a few approaches and techniques specific to Drupal when it comes to adding and using JavaScript files and we will talk about those here. Moreover, we will also prove how powerful Drupal...