Possible Duplicate:
What do parentheses surrounding a JavaScript object/function/class declaration mean?
What does this javascript syntax mean?
What does this “(function(){});”, a function inside brackets, mean in javascript?
In the below code the anonymous function is being executed.
var a= 1;
var b =2;
(function() {
var b = 3;
a += b;
})();
document.write(a + " "+ b);
1) What does putting parenthesis around the function definition do?
2) What does putting ()
after the closing parenthesis do?