Chapter 13. Modules: breaking a program into pieces
This chapter covers
- Importing code into JS Bin with script elements
- Avoiding repeated variable names
- Running functions without assigning them to variables
- Using modules to organize your (shared) codebase
As the applications you develop become larger, involving more and more variables, objects, arrays, and functions, it can become harder and harder to work efficiently within a single program file. Good text editors and development environments can help, but even with their tools, it quickly becomes a good idea to split the code across multiple files.
For example, in The Crypt you have spacer, players, places, maps, and the game logic itself. You’ve probably noticed how long the code ...
Get Get Programming with JavaScript 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.