title: "cannot read property 'split' of undefined"
body: <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>cannot read property 'split' of undefined</p>
  </blockquote>
  
  <p>However the <code>array</code> variable with the <code>split</code> method attached is correctly defined in the previous code line.</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>function findLongestWord(str) {
  
    for (i = 0; i &lt; str.length; i++) {
      var array = str.split(" ");
      array[i].split("");
    }
  }
  
  findLongestWord("The quick brown fox jumped over the lazy dog");</code></pre>
  </div>
  </div>
  </p>