coffeescript中apply(this,arguments)的等价物是什么?

Mih*_*rea 3 coffeescript

在javascript中你会写如下:

method.apply(this,arguments);
Run Code Online (Sandbox Code Playgroud)

但是,你怎么把它翻译成coffeescript?:

method.apply(@, arguments)
Run Code Online (Sandbox Code Playgroud)

参数变量有不同的名称吗?

And*_*ing 17

使用splats,您可以使用更清洁的coffeescript语法:

caller: ->
  @method arguments...
Run Code Online (Sandbox Code Playgroud)

以上编译为以下Javascript:

caller: function() {
  return this.method.apply(this, arguments);
}
Run Code Online (Sandbox Code Playgroud)


The*_*ppo 5

arguments也有咖啡脚本.所以你可以这样做:

method.apply @, arguments