demo:
try {
arr.forEach((item, index) => {
if (index === 1) throw new Error;
}
} catch {}
利用try catch 语句 中断退出
demo:
try {
arr.forEach((item, index) => {
if (index === 1) throw new Error;
}
} catch {}
利用try catch 语句 中断退出