title: Javascript variable declarations at the head of a function
body: <p>I've been told that javascript variables should all come before they are used in a function, such that:</p>
  
  <pre><code>function contrived() {
    var myA, myB;
  
    myA = 10;
    myB = 20;
  
    return myA + myB;
  }
  </code></pre>
  
  <p>Is prefered over:</p>
  
  <pre><code>function furtherContrivance() {
    var myA = 10;
    var myB = 20;
  
    return myA + myB;
  }
  </code></pre>
  
  <p>Is this the case? And why is that?</p>