0
下面给出相关的匿名函数语法错误:在CoffeeScript中,如何使用匿名函数作为参数进行函数调用?
my_function = (f, x, str) ->
alert str + f(x)
my_function (x) -> 1 + x, 12, "The answer is: "
以下工作:
my_function = (f, x, str) ->
alert str + f(x)
increment = (x) -> x + 1
my_function increment, 12, "The answer is: "
重复http://stackoverflow.com/questions/6463052/how-to-pass-two-anonymous-functions-as-arguments-in-coffescript。另见http://stackoverflow.com/questions/6459630/how-to-write-settimeout-with-params-by-coffeescript –