Modules are a way of encapsulating pieces of code and their dependencies. This is recommended for large and complex JavaScript projects.
Unfortunately there are few different ways of defining modules.
AMD, CommonJS were competing options, which are now superseded by ES6 which has now (2015-June) become standard.