title: Declaring variables at top of js file
body: <p>I have been declaring variables I use in multiple functions at the top of the file.</p>
  
  <pre><code>var a;
  
  window.onload = function() {
     a = 10;
  }
  
  function bar() {
    if(a &gt; 5)
      //do something
  }
  </code></pre>
  
  <p>This may be a bad example, but the question is does declaring variables at the top of the file harm anything?</p>