Part 2. Organizing your programs

Sharing code is common among programmers; many problems have been solved by others already, and your solutions could prove useful in your own future projects, to your team, or to the wider developer community. When code modules are shared, it’s important to make clear how others should use them by defining a clear interface, or set of properties and functions you expect users to utilize. The internals of a module—how you make it do its job—should be protected. Part 2 looks at ways of using local rather than global variables to hide a module’s implementation from other code.

As your programs grow, the need for organization increases, and you’ll start to notice patterns and procedures you use again and again. ...

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.