var log=[]; try { [1,2,3,"break it",4,5,6,7].forEach ( function(a){ log.push(a); if( a==='break it' ) throw ""; } ); } catch (e) {} alert( "Прошли : \n\n"+ log.join("\n") )