title: Console says JavaScript array is undefined, but I'm able to log its contents
body: <p>I have an array, <code>gradesArray</code>, which I'm able to see with <code>console.log(gradesArray)</code> within my program, but when I go to access it typing <code>gradesArray</code> or <code>gradesArray.length</code> or something similar into the (Chrome) console, I get <code>ReferenceError: gradesArray is not defined</code>.</p>
  
  <p>Here's the jQuery I use to fill the array with <code>Grade</code> objects:</p>
  
  <pre><code>$(document).on('click', '#savegrades', saveGrade);
  
  function saveGrade() {                     // grabbing data from a form
      var studentClass = currentClass;
      var studentName = currentStudent;
      var dateStamp = $(this).parents('#gradingform').children('#date').val().replace(/-/g, "");
      var teamwork = parseInt( $(this).parents('#gradingform').children('#teamwork').val() );
      var participation = parseInt( $(this).parents('#gradingform').children('#participation').val() );
      var punctuality = parseInt( $(this).parents('#gradingform').children('#punctuality').val() );
      var professionalism = parseInt( $(this).parents('#gradingform').children('#professionalism').val() );
      var timemanagement = parseInt( $(this).parents('#gradingform').children('#timemanagement').val() );
  
      var newGrade = new Grade(studentClass, studentName, dateStamp, teamwork, participation,         // create new Grade object from form values
                                  punctuality, professionalism, timemanagement);
  
      alert('class: ' + newGrade.studentClass + ', name: ' + newGrade.studentName + ', date: ' + newGrade.dateStamp + ', teamwork: ' + newGrade.teamwork + ', participation: ' + newGrade.participation + ', punctuality: ' + newGrade.punctuality + ', professionalism: ' + newGrade.professionalism + ', time management: ' + newGrade.timemanagement + ', total: ' + newGrade.total);
  
      gradesArray.push(newGrade);
      console.log(gradesArray);
  }
  </code></pre>
  
  <p>After this code runs, that <code>console.log(gradesArray)</code> bit works just fine, giving me a nice array of Grade objects. But when I type <code>gradesArray</code> into the console, I get a reference error telling me that the variable is undefined. Also, later in the program, I try to use <code>if (typeof gradesArray != 'undefined')</code>, but the function doesn't fire.</p>
  
  <p>What's the deal? The browser will log the array if I ask it to from the .js file, but it won't if I ask it to right from the console; and, even after I've filled it with objects, it's still undefined, even though they're showing up in the console.</p>
  
  <p>Thanks in advance.</p>