开发者

Call immediately executing function from outside

开发者 https://www.devze.com 2023-03-10 02:16 出处:网络
I\'ve got an immediately executing function and I need to call it from 开发者_运维问答outside:

I've got an immediately executing function and I need to call it from 开发者_运维问答outside:

(function myFunc(){    
  console.log("Hello from myFunc");
})();

I'm using named function because I'm doing a recursion in it so I can reference it. but at some point recursion stops. and I need to invoke this function once again.


Is there a reason you have to wrap it like that? Why don't you just make a normal named function and call it:

function myFunc(){    
  console.log("Hello from myFunc");
}
myfunc();
0

精彩评论

暂无评论...
验证码 换一张
取 消