title: javascript get subarray length
body: <p>I was wondering if there's a way to get the length of a second-level array, for example :</p>
  
  <pre><code>var arr = new Array();
  arr[0] = new Array();
  
  arr[0][0] = 'a';
  arr[0][1] = 'a';
  arr[0][2] = 'a';
  </code></pre>
  
  <p>I tried this, but without success :</p>
  
  <pre><code>arr[0].length;
  </code></pre>
  
  <p>Cheers!</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The evil code is as follows.</p>
  
  <p>This is the function that I use to fill the array, wich works as expected :</p>
  
  <pre><code>function input_text(action, id) {
      if (action == 'add') {
          var i = info.length;
          if (i != 0) i++;
          info[i] = new Array();
          info[i]['type'] = 'input';
          info[i]['subtype'] = 'text';
          info[i]['nome'] = $('#input_text_form input[name="input_text_nome"]').val();
          info[i]['name'] = $('#input_text_form input[name="input_text_name"]').val();
          info[i]['id'] = $('#input_text_form input[name="input_text_id"]').val();
          info[i]['maxlenght'] = $('#input_text_form input[name="input_maxlenght"]').val();
          info[i]['default'] = $('#input_text_form input[name="input_text_default"]').val();
          info[i]['js'] = $('#input_text_form input[name="input_text_js"]').val();
      }
  }
  </code></pre>
  
  <p>.. and this is a function to build a JSON string from the array. You may notice that I count the sublevel arrays length several times, in order to prevent the string from ending wrong, like <code>,}</code></p>
  
  <pre><code>function toJSON () {
      var fll = info.length;
      var sll = 0;
      var tll = 0;
      var i;
      var x;
      var z;
      var w;
      var b;
      json = '{';
      for (i in info) {
          json += '"'+i+'":{';
          sll = info[i].length;
          alert(sll);
          z = 0;
          for (x in info[i]) {
              if ($.isArray(info[i][x]))  {
                  json += '"'+x+'":{';
                  tll = info[i][x].length;
                  w = 0;
                  for (b in info[i][x]) {
                      tll == w ? json += '"'+b+'" : "'+info[i][x][b]+'"' : json += '"'+b+'" : "'+info[i][x][b]+'",';
                      w++;
                  }
                  sll == z ? json += '}' : json += '},';
              } else {
                  sll == z ? json += '"'+x+'" : "'+info[i][x]+'"' : json += '"'+x+'" : "'+info[i][x]+'",';
              }
              z++;
          }
          fll == i ? json += '}' : json += '},';
      }
  
      json += '}';
  }
  </code></pre>
  
  <p>Everytime I print the value of any of the fll, sll and tll variables, it gives me zero. </p>