title: Check for existence of key in multidimensional array in javascript
body: <p>Hopefully an easy question.</p>
  
  <p>Why is that checking for existence of a key in a multidimensional array: </p>
  
  <pre><code>a = new Array(Array());
  a[0][0]='1';
  a[0][1]='2';
  if(a[1][2] == undefined){
  alert("sorry, that key doesn't exist");
  } else {alert('good, your key exists');
  }
  </code></pre>
  
  <p>seems not to be working in general, but it works when I check for a first index (in this case, '0') that is 'defined' by <code>a[0][x]</code>. For example, when I ask for <code>a[0][2]</code> (which is not defined), it shows the first alert. However, when I ask for <code>a[1][0]</code>, I get: </p>
  
  <blockquote>
    <p>"Uncaught TypeError: Cannot read property '0' of undefined"</p>
  </blockquote>
  
  <p>How can I solve this problem?</p>
  
  <p>Thanks</p>