title: Order of JavaScript <script> tag executions not guaranteed in major browsers?
body: <p>Is it true that there are no guarantees across major browsers that the following script tags will always execute both sequentially AND in order of declaration? i.e. should I assume that the following code will not always yield x == 'ab' in alert?</p>
  
  <pre><code>&lt;head&gt;
      &lt;script type="text/javascript"&gt;
        //tag A
        var x = x || ''; x += 'a';
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        //tag B
        var x = x || ''; x += 'b';
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;script type="text/javascript"&gt;
         alert('x='+x);
      &lt;script&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>... and it's possible that x will instead be one of the following:</p>
  
  <ol>
  <li>'ba' - if tag B executes before A</li>
  <li>'a' or 'b' - race condition where A and B execute in parallel (Though seems like <a href="https://stackoverflow.com/questions/1663125/is-javascript-multithreaded/1663172#1663172">this</a> thread clearly says that browsers only allocate a single thread of JS)</li>
  </ol>