See how to use the () encapsulation.
// Immediate execution with one parameter...
(function(param){
alert ('Function 1: ' + param);
})(11);
// Immediate execution with one parameter, within an Immediate execution...
(function(param){
alert ('Function 2: ' + param);
}(22));
// Block with two Immediately executed functions
(
function(param){
alert ('Function 3: ' + param);
}(33),
function(param){
alert ('Function 4: ' + param);
}(33)
);
// Block with two, the second function will be executed immediately
(
function(param){ // this function will never be executed
alert ('Function 5: ' + param);
},
privateParam = 200, // this parameter can be used since here...
function(param){
alert ('Function 6: ' + (param + privateParam));
}
)(44);
// Defining and executing the function immediately after...
var Foo = 1 + function(){
return 55;
}();
alert ('Function 7: ' + Foo);
// Defining and executing the function immediately after with a parameter...
var Boo = function(param){
return 'Function 8: ' + (1 + param);
}(66);
alert (Boo);