【发布时间】:2012-08-29 13:42:59
【问题描述】:
可能重复:
jslint error: Unexpected 'in'. Compare with undefined, or use the hasOwnProperty
为什么 jslint 抱怨此代码以及我应该如何修复它。
if ('children' in object) {
for (key in object.children) {
recurse(object.children[key], key);
}
}
显然定义了递归。
【问题讨论】:
-
jslint 抱怨什么?请包括警告。
-
JSLint的抱怨正是原因:“Unexpected 'in'。与undefined比较,或者使用hasOwnProperty方法。”。
标签: javascript jslint