Tell us what’s happening:
Describe your issue in detail here.
**Your code so far**
function multiplyAll(arr) {
var product = 1;
// Only change code below this line
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= product*arr[i][j]*arr[i][j+1];
}
}
// Only change code above this line
return product;
}
multiplyAll([[1,2],[3,4],[5,6,7]]);
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36
I see the issue, but how about this:
Take a piece of paper and try to write down what your code is doing - you should only multiply 7 numbers so that’s shouldn’t cause a problem in writing.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
the solution to your question is almost completly given in the lesson description.
You have an array of arrays. You want to loop thru every element of the top array, and loop thru every number in that element(array).
You can do that using nested for loops. The tricky part is making sure you target the right element on every loop iteration, using the syntax to refer to an array elements, in the current challenge it would look like
arrayName[position of a sub-array][position of an item in sub-array]