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