title: Safe way to check if array element exists?
body: <p>I have a 2D array. 
  I currently access that array using notation such as:</p>
  
  <p><code>myArray[5][9]</code> (for example).</p>
  
  <p>What is the <em>safest way</em> to check whether or not a certain array element exists?
  For example, let's say I am looping through the array and retrieving a property of each array element like so:</p>
  
  <p><code>myArray[5][9].firstName</code></p>
  
  <p>I then come to <code>myArray[9][11].firstName</code> (for example) which doesn't exist. Clearly this will throw an exception as the element doesn't exist.</p>
  
  <p>How can I deal with this? I'm not looping through the entire array (i'm accessing it's contents randomly and say using <code>myArray.length</code>in a for loop will not work.</p>
  
  <p>Is there a JS function / method for checking whether or not an array element exists?</p>
  
  <p>Thanks.</p>