title: Get element inside of outside of function
body: <p>When manipulating DOM elements, is it faster to get them inside the function they are used, or just get them all at once and declare them as globals? For example, if we have to use an element with the ID <code>'order'</code> multiple times,</p>
  
  <p>would this be faster,</p>
  
  <pre><code>var ORDER = document.getElementById('order');
  function test() {
      ORDER.onchange = // manipulate ORDER
  }
  </code></pre>
  
  <p>or is this faster</p>
  
  <pre><code>function test() {
     var ORDER = document.getElementById('order');
     ORDER.onchange = // manipulate ORDER
  }
  </code></pre>
  
  <p>I'm asking because it's usually bad practice to declare so many global variables, but I can't help but think that getting an element once and assigning it to a global variable would be faster than getting it again and again for each function call.</p>