title: Array's content disappearing after using of function that push content into the array
body: <p>I'm trying to use at function that push content from xml into the array, I checked it and I see array's content in the function but after the function array's content is disappearing, why? Scope's problem? How I can fix it?
  Thanks!</p>
  
  <p>Javascript: </p>
  
  <pre><code>&lt;script&gt;
  var words = [];
  /*var words = [
                                                            {suomen:"puhua", englanti:"to talk", answer:false},
                                                            {suomen:"lukea", englanti:"to read", answer:false},
                                                            {suomen:"kirjoittaa", englanti:"to write", answer:false}
                                                            ];
  
  */
  loadDoc();
  alert("The array hasn't content: " + words.toString());
  
  function loadDoc() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState == 4 &amp;&amp; this.status == 200) {
        myFunction(this);
      }
    };
    xhttp.open("GET", "catalog.xml", true);
    xhttp.send();
  }
  
  function myFunction(xml) {
    var i;
    var xmlDoc = xml.responseXML;
    var x = xmlDoc.getElementsByTagName("WORD");
    for (i = 0; i &lt;x.length; i++) { 
                               var en =  String(x[i].getElementsByTagName("ENGLISH")[0].childNodes[0].nodeValue);
                               var fi =  String(x[i].getElementsByTagName("FINNISH")[0].childNodes[0].nodeValue);
                               words.push({suomen:fi, englanti:en, answer:false});
    }
  alert("The array has content: " + words.toString());
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>xml file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;
  &lt;CATALOG&gt;
  &lt;WORD&gt;
      &lt;FINNISH&gt;puhua&lt;/FINNISH&gt;
      &lt;ENGLISH&gt;to talk&lt;/ENGLISH&gt;
  &lt;/WORD&gt;
  
  &lt;WORD&gt;
      &lt;FINNISH&gt;lukea&lt;/FINNISH&gt;
      &lt;ENGLISH&gt;to read&lt;/ENGLISH&gt;
  &lt;/WORD&gt;
  &lt;WORD&gt;
      &lt;FINNISH&gt;kirjoittaa&lt;/FINNISH&gt;
      &lt;ENGLISH&gt;to write&lt;/ENGLISH&gt;
  &lt;/WORD&gt;
  
  &lt;/CATALOG&gt;
  </code></pre>