title: Javascript array value is undefined ... how do I test for that
body: <p>I am trying to test to see whether a Javascript variable is undefined.</p>
  
  <p>You will see that I am not expecting the value of predQuery[preId] to be 'undefined' if I don't first get an alert saying "its unbelievable". But I often do, so I am guessing that my statement</p>
  
  <pre><code> predQuery[preId]=='undefined') 
  </code></pre>
  
  <p>is not matching the undefined elements properly.</p>
  
  <pre><code>if((predQuery.length &lt; preId) || (predQuery[preId]=="") || (predQuery[preId]=='undefined')){
     alert("its unbelievable");
     alert(predQuery[preId]);
     queryPreds[variables] = preId;
     queryObjs[variables] = objId;
     predQuery[preId] = variables;
  }
  else {
      alert(predQuery[preId]);
     var predIndex = predQuery[preId];
     queryPreds[predIndex] = preId;
     queryObjs[predIndex] = objId;
  }
  </code></pre>
  
  <p>I can add more code if needed.</p>