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