title: Event listener on different object
body: <p>What is a better way to write this code, i feel like i should be able to reference the target in a less hard coded way. is it ok to add the actual object to the  variable instead, and if so, how do i test/verify where the event is added?</p>
  <pre><code>var o=&quot;window&quot;; // or &quot;document&quot; or &quot;body&quot; or maybe some at the moment unknown elements id
  
  if(o==&quot;window&quot;){
      window.addEventListener();
  } 
  else if(o==&quot;document&quot;){
      window.document.addEventListener();
  }
  else if(o==&quot;body&quot;){
      window.document.body.addEventListener();
  }
  </code></pre>