if (id) {
console.log('a')
return false
}
console.log('b')
if (id) {
console.log('a')
} else{
console.log('b')
}
if (id) {
console.log('a')
return false
}
console.log('b')
if (id) {
console.log('a')
} else{
console.log('b')
}
10 回答11.2k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
2 回答2.6k 阅读✓ 已解决
第二种嵌套多了就会出现这种情况,一般建议是先行 return ,避免嵌套过多在静态分析时做出不必要的判断。
