title: Single threaded nodejs run "parallelly"?
body: <p>Code snippet below,</p>
  
  <pre><code>rl = require('readline').createInterface({
      input: process.stdin
  })
  
  rl.on('line', (s) =&gt; {
      console.log(s)
      rl.close()
  })
  
  for (i = 0; i &lt; 2e9; i++) {}
  console.log(i)
  </code></pre>
  
  <p>Run it, quickly type a few chars e.g. <code>abcd</code> then hit <code>Enter</code> before <code>for</code> loop ends. Since <code>for</code> loop occupies the main thread, the output that I had expected would be:</p>
  
  <pre><code>2000000000
  abcd
  abcd
  </code></pre>
  
  <p>Why did the console show something below instead?</p>
  
  <pre><code>abcd
  2000000000
  abcd
  </code></pre>