Nesting For Loops (solution please)

Nesting For Loops (solution please)
0.0 0

#1

Tell us what’s happening:
i tried to solve it like below but showing error ,

Your code so far


function multiplyAll(arr) {
  var product = 1;
  var count = 0;
  // Only change code below this line
  for(var i=0;i<arr.length;i++){
   for (var j=0;j<arr[i].length;j++){
     product=product*arr[i][j];
     if(count==6){
       break;
     }else{
       product = product * arr[i][j];    
       count ++;
     }
       
     
    
   }
  }
  
  // Only change code above this line
  return product;
}

// Modify values below to test your code
multiplyAll([[1,2],[3,4],[5,6,7]]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/nesting-for-loops


#2

What are you trying to do with the following code:

if(count==6){
  break;
}else{
  product = product * arr[i][j];    
  count ++;
}

#3

dont change anything before // Only change code below this line
so you don’t need var count;
and you don’t need those if either.
just delete those and you are fine