Chapter 3. Modular JavaScript

This chapter covers

  • The definition of modules
  • Reasons to use modules in your SPA
  • A review of JavaScript scope and object creation
  • An analysis of a module’s syntax and mechanics
  • An introduction to module loading and AMD modules

JavaScript is a powerful yet extremely flexible language that has become the de facto standard for adding interactivity to web applications. Even large companies such as Amazon.com, Google, and Walmart rely on it. It’s remarkably easy to learn and even easier to add working code to a web page. So it’s no wonder that the freedom it offers and its ease of use have contributed to its popularity.

The friendliness of the language is a double-edged sword, though. In any language as dynamic ...

Get SPA Design and Architecture now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.