0
可能重复:
jslint error: Unexpected 'in'. Compare with undefined, or use the hasOwnProperty为什么JSLint的抱怨这个代码,我应该怎么解决这个问题
为什么JSLint的抱怨这个代码,我应该怎么解决它。
if ('children' in object) {
for (key in object.children) {
recurse(object.children[key], key);
}
}
显然是递归被定义。
jslint抱怨什么?请包括警告。 –
JSLint的投诉正是其中的原因:“意外”in。与undefined比较,或使用hasOwnProperty方法代替。“ – pimvdb