Part 3. Code

 

Now that you have your objects and functions in place, how and where do you place them? Part 3 looks into how to organize the components of your applications and take advantage of separation of logic. Up until now, this task was never easy because it required you to dive into the sea of module systems for your client-side code, which were managed differently from modules in the backend. And if you’re expecting any modules of shared, common logic to transition from, say, browsers to server easily, think again. This transition wasn’t possible before, but everything changed with JavaScript’s official, standard module system.

Chapter 6 introduces you to JavaScript’s official module system: ECMAScript Modules (ESM). ESM builds on the painfully learned lessons of earlier technologies with the goal of standardizing how code is imported and exported consistently in both client and server environments.