我从coffeescript开始.(还有英语,所以我对任何语法错误感到抱歉.)看看这堂课:
class Stuff
handleStuff = (stuff) ->
alert('handling stuff');
Run Code Online (Sandbox Code Playgroud)
它编译为:
var Stuff;
Stuff = (function() {
var handleStuff;
function Stuff() {}
handleStuff = function(stuff) {
return alert('handling stuff');
};
return Stuff;
})();
Run Code Online (Sandbox Code Playgroud)
在Html上我创建了一个Stuff实例,但该死的东西说它没有方法handleStuff.为什么?