I have an array that looks like this:
var array = [[10, 8, 2], [5, 7, 1], [3, 9, 4]];
I need something that tells me if the sub object exists, without throwing an error. Here's an example:
elementExsits(array[0][4]);
//false
elementExsists(array[1][2]);
//true
The function elementExsists would verify it the path exists. I've tried:
if (typeof array[3][2] !== 'undefined') {};
But it just says
Cannot read property '2' of undefined