"Nesting for Loops" Challenge

I’m just wondering what I am getting wrong with this code for failing to pass:

function multiplyAll(arr) {
var product = 1;
// Only change code below this line
var arr = [ [1,2], [3,4], [5,6,7] ];
for (var i=0; i < arr.length; i++) {
for (var j=0; j < arr[i].length; j++) { product *= arr[i][j];
}
}

// Only change code above this line
return product;
}

multiplyAll([[1,2],[3,4],[5,6,7]]);

hi, you don’t have to define arr, the challenge will give it to your function as input.
In your current code no matter what the challenge gives as input (e.g. arr=[[1],[22],[3]]), your function still outputs the result for arr = [ [1,2], [3,4], [5,6,7] ].

Thanks. I am grateful. I deleted the definition of varr and the challenge has passed.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.