try catch inside for loop node js code example
Example: try catch with for loop in javascript
let object = ['foo', 'bar'], i;
try {
for (i = 0, len = object.length; i <len; i++) {
// do something that throws an exception
}
}
catch (e) {
// handle exception
}