forEach 终止循环
1 let arr= ['baidu', 'google', 'taobao']; 2 try{ 3 arr.forEach(item=>{ 4 if(item == 'google'){ 5 throw new Error(); 6 } 7 }) 8 }catch(e){ 9 return; 10 }
1 let arr= ['baidu', 'google', 'taobao']; 2 try{ 3 arr.forEach(item=>{ 4 if(item == 'google'){ 5 throw new Error(); 6 } 7 }) 8 }catch(e){ 9 return; 10 }