What is CommonJS and why should I care how it can help in writing .js applications? [closed]
Solution 1:
CommonJS modules enables you to include javascript modules within the current scope and effectively keeps the global scope from being polluted.
This massively reduces the chance of naming collisions and keeps code organised.
That said I think it's pretty safe to say that AMD modules have now become more popular than CommonJS.
The RequireJS website has a very good section on why to use modules and the differences between CommonJS and AMD.