title: Comparing "tagName" property to "img" does not work for an <img> element
body: <p>I have this code snippet:</p>
  
  <pre><code>function switchEvent() {
      if (this.lastChild.tagName == "img" ) {
          var remove = this.lastChild;
          this.removeChild(remove);
      }
      else {
          console.log(this.lastChild);
  
          var image = document.createElement('img');
      }
  }
  </code></pre>
  
  <p>Note, in the second part, when I check the console.log, it prints out:</p>
  
  <pre><code>&lt;img height="20" width="75" src="btn2.png" style="left: -14px; right: 0px;"&gt;
  </code></pre>
  
  <p>It just skips over the 'if' and jumps to the 'else'. 
  uhhh,what?</p>
  
  <p>Edit: to fill you in, this is an onclick event. Therefore 'this' refers to the clicked element.</p>