title: Javascripts commands: window.alert vs console.log
body: <p>I am a newbie to javascript, so forgive my naiveté here. I have discovered a behavior that appears to be inconsistent, at least to me. In doing some testing I put in the following two lines of code:</p>
  
  <pre><code>console.log(document.getElementById("errorMessage"));
  window.alert(document.getElementById("errorMessage"));
  </code></pre>
  
  <p>I was fully expecting both to give me the same result, but no, I didn't.</p>
  
  <pre><code>console.log(document.getElementById("errorMessage"));
  </code></pre>
  
  <p>gave me:</p>
  
  <pre><code>    &lt;span id="errorMessage"&gt;
  </code></pre>
  
  <p>whereas</p>
  
  <pre><code>window.alert(document.getElementById("errorMessage"));
  </code></pre>
  
  <p>gave me the alert window with:</p>
  
  <pre><code>    [Object HTMLSpanElement]
  </code></pre>
  
  <p>Can anyone help me understand why I got different results even though I passed the exact same arguments?</p>
  
  <p>Added note: This is not a duplicate question, for the one referenced above asks which is better, and not what is the difference between the two.</p>