JavaScript function evaluating itself and calling itself at the same time
This question already has an answer here:
Google "Immediately Invoked Function Expression" or "IIFE".
The general syntax looks like this:
(function(){
// do something here
})():
Sometimes you'll see arguments passed in as well. It's basically used to wrap your code so none of your variables leak out into the global namespace.
链接地址: http://www.djcxy.com/p/80926.html