[removed] inline functions vs predefined functions

前端 未结 13 1908
心在旅途
心在旅途 2020-12-02 11:00

Can any body throw me some arguments for using inline functions against passing predefined function name to some handler.

I.e. which is better:

13条回答
  •  萌比男神i
    2020-12-02 11:55

    I think that the only difference in a code like that is that with the second piece of code you can re-call the same function (sometimes with "timer functions" it's useful):

    (function(){
      function invokeMe() {
        if(..) setTimeout(invokeMe, 5);
      }
      setTimeout(invokeMe, 5);
    })();
    

提交回复
热议问题