title: firefox console fails to define a varaible
body: <p>after I excute that code in the firefox console, I receive an  erorr thay says" ReferenceError: abc is not defined". how do I fix that to make it work?
  its looks like after the IF ends, the FOR forgets the value of the varirable "abc". what to do?
  please help</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>for (i = 0; i &lt; 10; i++) {
    if (i == 0 || i == 5) {
      var xhttp = new XMLHttpRequest();
      xhttp.onreadystatechange = function() {
        if (this.readyState == 4 &amp;&amp; this.status == 200) {
          var str = this.responseText;
          var text = str.split('?id = "')[1];
          var abc = text.split('";')[0];
        }
      };
      xhttp.open("GET", "http://example.com", true);
      xhttp.send();
    }
  
    fetch("http://www.example.com/post.php", {
      "credentials": "include",
      "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0",
        "Accept": "*/*",
        "Accept-Language": "en-US,en;q=0.5",
        "Content-Type": "application/x-www-form-urlencoded",
        "X-Requested-With": "XMLHttpRequest"
      },
      "referrer": "http://www.example.com/index.php",
      "body": "id=" + abc + "",
      "method": "POST",
      "mode": "cors"
    });
  }</code></pre>
  </div>
  </div>
  </p>