(function($) {
var foo = (function(){
//some functions
})();
// I can access foo here
var f = new foo();
})(jQuery);
// But obviously not here since it's in another scope
如何返回foo
窗口范围,以便可以在外部 IIFE 之外访问它?我试过return foo;
了,但没有用。