在coffeescript中迭代方法名

在coffeescript中迭代方法名,coffeescript,Coffeescript,在JS中,我可以这样做: for(i in MyClass.prototype) { console.log(i); } 它将向我显示方法名。那很好 现在,如果我用coffeescript这样做: for i in MyClass.prototype console.log i 它将被汇编为: var i, _i, _len, _ref; _ref = MyClass.prototype; for (_i = 0, _len = _ref.length; _i < _len;

在JS中,我可以这样做:

for(i in MyClass.prototype) {
  console.log(i);
}
它将向我显示方法名。那很好

现在,如果我用coffeescript这样做:

for i in MyClass.prototype
  console.log i
它将被汇编为:

var i, _i, _len, _ref;

_ref = MyClass.prototype;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
  i = _ref[_i];
  console.log(i);
}
var i、\u i、\u len、\u ref;
_ref=MyClass.prototype;
对于(_i=0,_len=_ref.length;_i<_len;_i++){
i=_ref[_i];
控制台日志(i);
}
但prototype没有
length
属性,所以它会中断


如何使用coffeescript制作?

使用对象时,“秘诀”是使用
命令:

console.log i for i of MyClass.prototype

多亏了你的链接,我才明白!