Aetae,
Ога
arr=[]
i=1000000
while(i--){arr.push(i)}
i=1000000
withTry=function(name){
console.time(name)
try{
arr.forEach(function(el) {if(el===1||el===(i-1)) throw el})
}catch(e){console.log(e)}
console.timeEnd(name)
}
withOutTry=function(name){
console.time(name)
arr.forEach(function(el) {if(el===1||el===(i-1)) console.log(el)})
console.timeEnd(name)
}
withTry("with")
withOutTry("without")
// ::: 999999
// ::: with: 2ms
// ::: 999999
// ::: 1
// ::: without: 117ms
И про память не забудь. Говностек никто не отменял.