forEach 如何提前終止 跳出運行
try{ arr.forEach(function(item,index){ if (...) { foreach.break=new Error("StopIteration"); } }); }catch(e){ if(e.message==="foreach is not defined") { return; }else throw e; }
《JavaScript權威指南(6版)》7.9.1 forEach()
.
forEach 如何提前終止 跳出運行
try{ arr.forEach(function(item,index){ if (...) { foreach.break=new Error("StopIteration"); } }); }catch(e){ if(e.message==="foreach is not defined") { return; }else throw e; }
《JavaScript權威指南(6版)》7.9.1 forEach()
.
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。