I often see the following code:
(function () {
// init part
})();
but I never could get my head around how it works. I find the last brac
In simple word you can understand that whenever page load, by this second pair of brackets () function will have called default.We need not call the function.It is known as anonymous function.
i.e.
(function(a,b){
//Do your code here
})(1,2);
It same like as
var test = function(x,y) {
// Do your code here
}
test(1,2);