Possible Duplicate:
Are “(function ( ) { } ) ( )” and “(function ( ) { } ( ) )” functionally equal in JavaScript?
Is there a difference between these two?
(function () {}());
and
(function () {})();
What do you think about this for building objects within a global:
;(function () {
'use strict';
this.menu = (function () {
var version = "1.2.111",
someFunction = function() {
console.log("Version: " + version);
return version;
};
return {
getVersion: someFunction
};
})();
this.someObject = (function () {
var privateVar = "1234",
privateFunction = function () {
console.log("Private Variable: " + privateVar);
return privateVar;
};
return {
publicFunction: privateFunction
};
})();
}).apply(window.saif = window.saif || {});