I wanted to write a little helper function to return 0 if the js array raises undefined for a nested element in an array. The problem i have is that if the first index already fails and raises undefined error. The nested index is not going to fail at the second index which should! But it's not getting there. How would it be best to catch all errors here?
function helper_check(arr){
if (typeof(arr) == 'undefined') {
return 0
}
var some_var = helper_check(some_arr[0][1]) // so here some_arr[0] already fails and raises an error but i want to catch all errors witht he helper function