title: Why does the "g" modifier give different results when test() is called twice?
body: <p>Given this code:</p>
  
  <pre><code>var reg = /a/g;
  console.log(reg.test("a"));
  console.log(reg.test("a"));
  </code></pre>
  
  <p>I get this result:</p>
  
  <pre><code>true
  false
  </code></pre>
  
  <p>I have no idea how this could happen. I have tested in both Node.js (v8) and Firefox browser.</p>