0
我想写遵循js代码中的CoffeeScriptJS转换为CoffeeScript的
var test = (function(test) {
test.s = function(){
console.log('hello')
}
return test;
}(test || {}));
test.s();
我用js2coffee。而我得到
test = ((test) ->
test.s = ->
console.log "hello"
return
test
(test or {}))
test.s()
但这代码不起作用/我在JS生成该CoffeeScript中我得到了另一个js代码
var test;
test = (function(test) {
test.s = function() {
console.log("hello");
};
return test;
}, test || {}); // this line is different
test.s();
你能帮助我。如何CoffeeScript的我的js脚本写在正确
谢谢你们两位。所有解决方案都是对的 – user3592084