break : 结束循环
continue: 结束当前一次循环,开始下次循环
for (let i = 0; i < 4; i++) {
if (i == 2) {
break
}
for (let j = 0; j < 2; j++) {
console.log("i=" + i + ", j=" + j)
}
console.log("========")
}
for (let i = 0; i < 4; i++) {
if (i == 2) {
continue
}
for (let j = 0; j < 2; j++) {
console.log("i=" + i + ", j=" + j)
}
console.log("========")
}