title: getElementById returns object, getElementsByName returns none
body: <p>I have the following code    </p>
  
  <pre><code>var commentId = 1834;
  
  alert("getElementsByName:: " + typeof(document.getElementsByName("tmp_airDiff" + commentId)[0]));   
  alert("getElementById:: " + typeof(document.getElementById("tmp_airDiff" + commentId)));
  </code></pre>
  
  <p>There is no element having <code>tmp_airDiff1834</code> as id or name in the document.</p>
  
  <p>Yet here's what I get back:</p>
  
  <pre><code>getElementsByName:: undefined
  getElementById:: object
  </code></pre>
  
  <p>Could anyone explain why <code>getElementById</code> returns <code>object</code> when using <code>typeof</code>, when there is no such object in the document?</p>