Organizing with modules

Organizing your code is paramount as you scale your codebase. The module system in JavaScript is a good fit here. It allows you to break the responsibilities of your program into distinct modules (files) and create dependencies between them.

Higher level modules depend on lower level modules. You export some code from a lower-level module, which gets consumed via an import from the higher-level module.

In this lesson, we will move our helper functions into a service module and import from index.js.

To learn more, visit the MDN pages on import and export