今天在复制代码时,碰到死轮回,致使在 Console 内里实行没有反应:
var s = []
var newA = unique(a)
var newB = unique(b)
for (var i = 0; i < newA.length; i++) {
var index = newA[i]
s.push(index)
}
for (var j = 0; j < newB.length; i++) {
var element = newB[j]
if (!newA.includes(element)) {
s.push(element)
}
}
个中第二个轮回是直接粘贴的,个中的 i 遗忘修正,准确的代码是:
var s = []
var newA = unique(a)
var newB = unique(b)
for (var i = 0; i < newA.length; i++) {
var index = newA[i]
s.push(index)
}
for (var j = 0; j < newB.length; j++) {
var element = newB[j]
if (!newA.includes(element)) {
s.push(element)
}
}
后续应当防止犯这个毛病