Javascript closure syntax
问题 What is the difference, pros/cons (if any) between these constructs? new function(obj) { console.log(obj); }(extObj); vs (function(obj) { console.log(obj); })(extObj); 回答1: If you're looking at dealing expressly with an immediately-invoked function, then there isn't any real difference between the two, except that the first one will return this inside the function, to the outside world, automatically (that is what new does), and by default if a different return value is not specified (regular