title: Find table data store in within an array of arrays
body: <p>I need to get data from a table and store it in an array. Each row of the table should be a new array within an array. Basically the html looks like this:</p>
  
  <pre><code>&lt;table id="contactlisttable"&gt;
      &lt;tr&gt;
          &lt;th&gt;Name&lt;/th&gt;
          &lt;th&gt;Title&lt;/th&gt;
          &lt;th&gt;Phone&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="contactlist contactlistlastfirst"&gt;Joey&lt;/td&gt;
          &lt;td class="contactlist contactlisttitle"&gt;webdesigner&lt;/td&gt;
          &lt;td class="contactlist contactlistphone"&gt;5555555&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td class="contactlist contactlistlastfirst"&gt;Anthony&lt;/td&gt;
          &lt;td class="contactlist contactlisttitle"&gt;webdesigner&lt;/td&gt;
          &lt;td class="contactlist contactlistphone"&gt;5555555&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt; 
  </code></pre>
  
  <p>ect...</p>
  
  <p>Here is my code</p>
  
  <pre><code>jQuery(document).ready(function(){
      $(function(){
          var $table = $("#contactlisttable"),
          $headerCells = $table.find("tr th"),
          $myrows = $table.find("tr"); // Changed this to loop through rows
  
          var headers = [],
              rows = [];
  
          $headerCells.each(function() {
              headers[headers.length] = $(this).text();
          });
  
          $myrows.each(function() {
              $mycells = $myrows.find( "td.contactlist" ); // loop through cells of each row
              cells = []
              $mycells.each(function() {
                  cells.push($(this).text());
              });
              if ( cells.length &gt; 0 ) {
                  rows.push(cells);
              }  
          });
          console.log(headers);
          console.log(rows);
      }); 
  });
  </code></pre>
  
  <p>my current code out puts </p>
  
  <pre><code>[["Waddell, Joey", "webdesigner", "", 15 more...], ["Waddell, Joey", "webdesigner", "", 15 more...],
  </code></pre>
  
  <p>the desired output would be:</p>
  
  <pre><code>["Name","Title","Phone"]
  [["Joey","webdesigner","555555"]
  ["Anthony","webdesigner","555555"]]
  </code></pre>