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

后端 未结 8 1547
半阙折子戏
半阙折子戏 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.

    0 讨论(0)
  • 2021-01-30 00:11

    It should be

    f = () ->
      # do something
    
    0 讨论(0)
提交回复
热议问题