Is there a cleaner/shorter way of checking whether a multidimensional array is undefined (which avoids an undefined error at any dimension) than:
if(arr != undefined && arr[d1] != undefined && arr[d1][d2] != undefined){
// arr[d1][d2] isn't undefined
}
As doing the following will throw an error if either arr or arr[d1] is undefined:
if(arr[d1][d2] != undefined){
// arr[d1][d2] isn't undefined
}
if (arr && arr[d1] && arr[d1][d2]) { .. }- Arrays are never falsy, so this works.arr = null.