nesting for loops

Solutions on MaxInterview for nesting for loops by the best coders in the world

showing results for - "nesting for loops"
Jan
29 Apr 2017
1let arr = [
2  [1,2], [3,4], [5,6]
3];
4for (let i=0; i < arr.length; i++) {
5  for (let j=0; j < arr[i].length; j++) {
6    console.log(arr[i][j]);
7  }
8}
David
28 Feb 2016
1function multiplyAll (arr){
2    var product = 1;
3    
4    for(var i=0; i < arr.length; i++ ){
5        for(var j=0; j < arr[i].length; j++){
6            product *= arr[i][j];
7        }
8            
9    
10    }
11    
12    return product;
13}
14
15var product = multiplyAll([[1,4], [5,9], [7,2,4]]);
16
17console.log(product);
queries leading to this page
nesting for loopsnesting for loops