Design
foo()();
expects foo() return a function and call it immediately. This is equivalent to more readable:
var func = foo(); func();
A similar design you'll often see is:
(function() {
This defines the function and calls it immediately. The main use is to emulate a block area for variables.
source share