Convert MultiDimensional Array into a single dimension Array


/ Published in: JavaScript
Save to your folder(s)

Use this to convert a Multidimensional Array (an array of arrays) into one long array. Great to use before running the unique script for instance


Copy this code and paste it in your HTML
  1. for (i=0; i<multiArray.length; i++) {
  2. for (x=0; x<multiArray[i].length; x++) {
  3. singleArray.push(multiArray[i][x]);
  4. };
  5. };

Report this snippet


Comments


You need to login to view comments.