title: addEventListener vs onclick
body: <p>What's the difference between <code>addEventListener</code> and <code>onclick</code>?</p>
  <pre><code>var h = document.getElementById(&quot;a&quot;);
  h.onclick = dothing1;
  h.addEventListener(&quot;click&quot;, dothing2);
  </code></pre>
  <p>The code above resides together in a separate <code>.js</code> file, and they both work perfectly.</p>