title: JavaScript - refactor getElementById
body: <p>I use alot of getElementById and I have a question about what is the best way to refactor it.</p>
  
  <p>As many already did, I use this code to make it simpler, easier and to reduce the file size:</p>
  
  <pre><code>    function $(id){
  return document.getElementById(id);
  }
  </code></pre>
  
  <p>But over to what I need help with: is it better to add a variable with the <code>document.getElementById</code> and just change them in every function I need it? Or, should I just stick to what I already have (the usage of <code>$(id)</code>)</p>