how to write setTimeout with params by Coffeescript

前端 未结 6 1096
轮回少年
轮回少年 2020-12-12 10:38

Please tell me how to write javascript below in coffeescript.

setTimeout(function(){
    something(param);
}, 1000);
6条回答
  •  青春惊慌失措
    2020-12-12 11:27

    This will result in a roughly equivalent translation (thanks @Joel Mueller):

    setTimeout (-> something param), 1000
    

    Note that this isn't an exact translation because the anonymous function returns the result of calling something(param) instead of undefined, as in your snippet.

提交回复
热议问题