Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js loop array in array

// This is a way to loop threw a 2 dimensional array.
// If the array has even more dimension you have to use recurrsion.

const Arrays = [["Array 1"], ["Array 2"]];

Arrays.forEach((array, index) => {        
  console.log(index);
  
  array.forEach((item, index) => {
    console.log(item);
  });
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #loop #array #array
ADD COMMENT
Topic
Name
9+3 =