title: .push is not a function, using Javascript and localstorage
body: <p>I checked out all the links relating to this topic that I could and I found out that the reason why this is probably occurring is because my variable is not an array. I'm not too sure how to fix this. This is my code:</p>
  
  <pre><code>        function addStudent() {
              var newStudentInfo = {
                  'studentNumber': document.getElementById("addStudentStudentNumber").value,
                  'name': document.getElementById("addStudentName").value
              }
  
              var oldStudentInfo = [];
              oldStudentInfo = JSON.parse(localStorage.getItem("students")) || [];
              oldStudentInfo.push(newStudentInfo); 
              localStorage.setItem("students", JSON.stringify(oldStudentInfo));
          }
  </code></pre>
  
  <p>When looking at errors in google chrome, it tells me</p>
  
  <pre><code>Paused on exception: 'TypeError: oldStudentInfo.push is not a function'.
  </code></pre>
  
  <p>Where did I mess up? All help will be appreciated. Thanks!</p>