title: Why am I getting undefined output Javascript?
body: <p>I keep getting undefined before my output text in JS.
  Here is my code. </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;link rel="stylesheet" type="text/css" href="css/style.css"&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;title&gt;Learning javascript&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
      &lt;p id="arrayString"&gt;&lt;/p&gt;
  
  
  
      &lt;!-- Javascript --&gt;
      &lt;script type="text/javascript" src="JS/app2.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my JS</p>
  
  <pre><code>var arrayString;
  var myArray=["Ms.Vickies", "Old Dutch", "Lays"];
  for (var i=0; i&lt;myArray.length; i++) {
      arrayString=arrayString+myArray[i];
  }
  document.getElementById("arrayString").innerHTML=arrayString;
  </code></pre>
  
  <p>my output is <code>undefinedMs.VickiesOld DutchLays</code></p>
  
  <p>In addition why no spaces? I am new to JS but am working my way up. Cannot figure this out.</p>