How to create module in angularjs and What is the use of module in angularjs?

//The above (with [] module) is indicate that this a setter function its used for register a module.

varapp= angular.module("MyApp");

//The above (without [] module) is indicate that this is getter function and its used for retrieve a previously registered module.

var app= angular.module("MyApp", []);
//The above (with [] module) is indicate that this a setter function its used for register a module.
var app= angular.module("MyApp");
//The above (without [] module) is indicate that this is getter function and its used for retrieve a previously registered module.