I have recently started the Angular.js tutorial which shows code written inside of an Immediately Invoked Function Expression (IIFE). I was wondering why should we put our JavaScript inside such a construct? Is it because of security reasons?
Eg: Why this:
(function(){
var app = angular.module("AppName", [])
})();
And not just this:
var app = angular.module("AppName", [])