webStorm编辑器中报警告:Possible iteration over unexpected (custom / inherited) members, probably missing hasOwnProperty check
问题:没有hasOwnProperty验证

解决:添加 hasOwnProperty 验证
for (var key in res.data.missing) {
if (res.data.missing.hasOwnProperty(key)) {
const element = res.data.missing[key]
if (element != null) {
unfinished.push({
vol: key,
timeInterval: element
})
}
}
}
本文解决WebStorm编辑器中出现的Possibleiterationoverunexpected(custom/inherited)members警告,通过添加hasOwnProperty检查,确保迭代只进行预期的自定义或继承成员。
3196

被折叠的 条评论
为什么被折叠?



