title: Data Races in JavaScript?
body: <p>Lets assume I run this piece of code.</p>
  
  <pre><code>var score = 0;
  for (var i = 0; i &lt; arbitrary_length; i++) {
       async_task(i, function() { score++; }); // increment callback function
  }
  </code></pre>
  
  <p>In theory I understand that this presents a data race and two threads trying to increment at the same time may result in a single increment, however, nodejs(and javascript) are known to be single threaded. Am I guaranteed that the final value of score will be equal to arbitrary_length?</p>