The word module refers to small units of independent, reusable code . A typical module is a cohesive block of code dedicated to a single purpose. A module exports something of value in that code, typically one thing, such as an object.
This chapter is all about introducing the concepts of the different modules. It doesn’t include many coding examples—you will be coding modules later on.
JavaScript gives you the freedom to do many things very badly—you’re under no obligation to write reusable code. You can scatter your code anywhere. This has to change now that JavaScript and its environment are maturing. ...