this maybe a little late however my understanding of the asker's question is such that
how does this magic work:
(function(){}) ('input') // utilised in his example I maybe wrong however the usual practice that people are familiar with is
(function(){}('input') ) the reason is such that javascript parentheses aka (), can't contain statements and when the parser encounters the function keyword, it knows to parse it as a function expression and not a function declaration.
source: http://benalman.com/news/2010/11/immediately-invoked-function-expression/