Coffeescript — How to create a self-initiating anonymous function?

后端 未结 8 1558
半阙折子戏
半阙折子戏 2021-01-29 23:43

How to write this in coffeescript?

f = (function(){
   // something
})();

Thanks for any tips :)

8条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-30 00:08

    do ->
        #your stuff here
    

    This will create a self executing closure, which is useful for scoping.

提交回复
热议问题