在Javascript中,"for(attr in this)"通常很危险...我同意.这就是我喜欢Coffeescript的原因之一.但是,我正在使用Coffeescript进行编程,并且我需要Javascript的"for(attr in this)".在Coffeescript中有一个很好的方法吗?
我现在正在做的是在嵌入式原始Javascript中编写一堆逻辑,例如:
...coffeescript here...
for (attr in this) {
if (stuff here) {
etc
}
}
Run Code Online (Sandbox Code Playgroud)
使用尽可能少的Javascript是很好的...有关如何实现这一点以及最大限度地使用Coffeescript的任何建议?
coffeescript ×1