const arrayToCSV = (arr, delimiter = ',') =>
        arr.map(v => v.map(x => `"${x}"`).join(delimiter)).join('\n');
      arrayToCSV([['a', 'b'], ['c', 'd']]); // '"a","b"\n"c","d"'
      arrayToCSV([['a', 'b'], ['c', 'd']], ';'); // '"a";"b"\n"c";"d"'
      

      Javascript language logo
      Array To CSV

      Convert array elements to CSV

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.