scr*_*key 1 javascript coffeescript
如何在CoffeeScript中创建一个命名函数表达式,如下例所示?
var a = function b (param1) {}
Run Code Online (Sandbox Code Playgroud)
要么
return function link (scope) {}
Run Code Online (Sandbox Code Playgroud)
我可能有点迟到了,但我刚刚意识到你实际上在使用class关键字时创建了命名函数.
例:
class myFunction
# The functions actual code is wrapped in the constructor method
constructor: ->
console.log 'something'
console.log myFunction # -> function AppComponent() { ... }
myFunction() # -> 'something'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1054 次 |
| 最近记录: |