const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const _ = require('lodash'); let outArr = []; try { arr.forEach(obj => { console.log(obj); if (obj < 3) { outArr.push(obj); } else { throw new Error('brack'); } }); } catch (err) { }
const arr = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; const _ = require('lodash'); let outArr = []; try { arr.forEach(obj => { console.log(obj); if (obj < 3) { outArr.push(obj); } else { throw new Error('brack'); } }); } catch (err) { }