title: Storing Cookie Data from Table to 2D Array
body: <p>I have a html table that takes in both string and int data - I want to set a cookie on this table and then store the data to a 2d array so that I can then repopulate the table with this data. So far I have this which sets the cookie but I would like to do with an array instead .</p>
  
  <pre><code> function setCookie(cname, cvalue, exdays) {
  
      var d = new Date();
      d.setTime(d.getTime() + (exdays*24*60*60*1000));
      var expires = "expires="+ d.toUTCString();
      document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
  }
  
  function saveTable() {
  
      var data = '';
  
        for (var i = 0; i &lt; table.rows.length; i++) {
          for (var j = 0; j &lt; table.rows[i].cells.length; j++) {
             data += table.rows[i].cells[j].innerHTML + ",";
         }
       }
       data = table.rows.length + "," + table.rows[0].cells.length + "," + data.substring(0, data.length); // remove the last extra ","
        setCookie("marks", data, 60);
        alert("Cookie Saved");
  }
  </code></pre>