title: JavaScript array push not working
body: <p>I am trying to push a value into an array and it is giving me this error in the developer tools.</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'push' of null</p>
  </blockquote>
  
  <p>Here is the code that it seems to be sticking on, word and local word were defined earlier like this.</p>
  
  <pre><code>var word = [];
  var localWord = []; 
  
  function setLocalArray() {
      // first get words from text field and update word array.
      word = document.getElementById("words").value.split(',');
  
      // store word array in localStorage            
      for(var i=0; word.length &gt; i; i++) {
          var key2 = "part"+i;
          localStorage.setItem(key2,word[i]);
          localWord.push(key2);
      }
  
      localStorage.setItem("localWord",JSON.stringify(localWord));
      text2Array();
      reveal();
  }
  </code></pre>
  
  <p>localWord.push(key2); Seems to be what it is getting stuck on. I have looked at everything I can find on the push method and I can't seem to find why it is giving me this error. Help? </p>
  
  <p>Here is the full code at jsfiddle  <a href="http://jsfiddle.net/runningman24/jnLtpb6y/" rel="noreferrer">http://jsfiddle.net/runningman24/jnLtpb6y/</a>   </p>