title: Problem with getting length of array from JSON ajax request in JavaScript when array not object
body: <p>I have a problem with getting the length of an array, when it is not initialized in the format: <code>var variable = new Array();</code></p>
  
  <p>Here is my code:</p>
  
  <pre><code>var inx;
  var qns;
  var qis;
  var ncs;
  var nzs;
  var tps;
  
  function display_question()
  {
  
     $( "#question_no" ).text( qns[ inx ] );
     $( "#question_nc" ).text( ncs[ inx ] );
     $( "#question_nz" ).text( nzs[ inx ] );
     $( "#the_question" ).hide();
     $( "#the_question" ).text( tps[ inx ] );
     $( "#the_question" ).fadeIn( 500 );
  
  }
  
  function next_question()
  {
  
     var arr_len = qns.length;
  
     if( inx &lt; arr_len )
     {
  
        inx++;
        display_question();
  
     }
  
  }
  
  function prev_question()
  {
  
     if( inx &gt; 0 )
     {
  
        inx--;
        display_question();
  
     }
  
  }
  
  function get_questions()
  {
  
     var url = "php/pytania.php"; 
  
     $.ajax(
     {
  
        cache: false,
        async: false,
        type: "GET",
        dataType: "text",
        url: url,
        success: function( response ) 
        { 
  
           data = jQuery.parseJSON( response );
  
           inx = 0;
           qns = data.qns;
           qis = data.qis;
           ncs = data.ncs;
           nzs = data.nzs;
           tps = data.tps;
           display_question();
  
        }
  
     } );
  
  }
  </code></pre>
  
  <p>The problem is that when I try to return the length of qns like so: qns.length, it doesn't return anything. I suspect that this may be because when i read in the array from the JSON response, it is not as an array object. Is there any way to fix this? I'd appreciate any help! :)</p>