I've never understood the module specification in JS (CommonJs AMD CMD) (as if I don't understand it now)
1.CommonJS
The CommonJS API provides a number of common applications (primarily non-browser apps) that use the API, and it is said that the ultimate goal is to provide a library of similar python,ruby and Java standards (I copied)
In a system compatible with COMMONJS, you can use JavaScript to develop the following programs:
(1). Server-side JavaScript applications
(2). command-line tools
(3). Graphical Interface Application
(4). Hybrid applications (e.g., titanium or Adobe AIR)
Commonjs defined module is divided into: {Module reference (require)} {module definition (exports)} {module identification (modules)}
Require () to introduce external modules
The exports object is used to export the current module's method or variable, the only export;
Module objects represent the modules themselves.
2.AMD
CommonJs AMD CMD