如何在CoffeeScript中的函数定义之后链接函数调用?
等效的javascript将是:
var foo = function () {
// stuff
}.bar()我成功做到这一点的唯一方法是:
foo = `function () {
// stuff
}.bar()`但是我希望有一个比在我(漂亮的) coffeescript代码中嵌入javascript更好的解决方案
发布于 2013-04-09 13:54:52
试着这样做:
foo = (-> stuff).bar()例如:
square = ((x)-> x*x).bar()编译为:
var square;
square = (function(x) {
return x * x;
}).bar();https://stackoverflow.com/questions/15894232
复制相似问题