寫入時類似的東西:爲什麼coffeescript在任何地方都使用«return»語句?
$(document).ready ->
doSomething()
doSomething = ->
alert('Nothing to do')
被編譯成
$(document).ready(function() {
return doSomething();
});
doSomething = function() {
return alert('Nothing to do');
};
在我的理解中,return語句是值(字符串,數組,整數......)
爲什麼coffeescript做到了嗎?
只是爲了編寫統一/很好的腳本和'返回警報('沒有做');'==返回; – 2013-03-24 13:02:53