This will return it in a single check with try / catch.
function isUndefined(_arr, _index1, _index2) { try { return _arr[_index1][_index2] == undefined; } catch(e) { return true; } }
Demo: http://jsfiddle.net/r5JtQ/
Usage example:
var arr1 = [ ['A', 'B', 'C'], ['D', 'E', 'F'] ]; // should return FALSE console.log(isUndefined(arr1, 1, 2)); // should return TRUE console.log(isUndefined(arr1, 0, 5)); // should return TRUE console.log(isUndefined(arr1, 3, 2));
source share