var a = [1, 2, 3]; try { a.forEach(function(element) { console.log(element); throw "xxx"; }); } catch(err) {} a.forEach(function(element) { console.log(element); });