title: saving array content as csv file js
body: <p>I have an array that has another array in it.
  I'm trying to save this array in a csv file, via this script , and it doesn't work. It doesn't download my file... </p>
  
  <pre><code>    var data =(JSON.stringify(allFileGenesDetails1));
      var csvContent = '';
      data.forEach(function (infoArray, index) {
          dataString = infoArray.join(';');
          csvContent += index &lt; data.length ? dataString + '\n' : dataString;
      });
  
      var download = function(content, fileName, mimeType) {
      var a = document.createElement('a');
          mimeType = mimeType || 'application/octet-stream';
  
          if (navigator.msSaveBlob) { // IE10
              return navigator.msSaveBlob(new Blob([content], { type: mimeType }), fileName);
          } else if ('download' in a) { //html5 A[download]
              a.href = 'data:' + mimeType + ',' + encodeURIComponent(content);
              a.setAttribute('download', fileName);
              document.body.appendChild(a);
              setTimeout(function() {
              a.click();
              document.body.removeChild(a);
              }, 66);
          return true;
      } else { //do iframe dataURL download (old ch+FF):
          var f = document.createElement('iframe');
          document.body.appendChild(f);
          f.src = 'data:' + mimeType + ',' + encodeURIComponent(content);
  
          setTimeout(function() {
              document.body.removeChild(f);
          }, 333);
          return true;
          }
      }
  
          download(csvContent, 'csv file.csv', 'text/csv');
  </code></pre>