function multiplyAll(arr) {
var product = 1;
// 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]);
}
}
// 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:66.0) Gecko/20100101 Firefox/66.0.
Nested arrays were confusing to me the first time I worked with them too. Two-dimensional arrays are used a lot, so the more you work with them, the easier it will become.
If you have ever worked with a spreadsheet program like MS Excel or Google Sheets, you could think of a spreadsheet as a two-dimensional array. The rows would contain the sub arrays (columns) of the main array (the spreadsheet).
@royalgreen50, in case you don’t know this, you can bookmark his response. Click on the elipsis (…) and then click on the bookmark tab. You can always get to it again by clicking on your icon and clicking on the bookmark tab there. It will show you all of your bookmarks and you’ll be able to read the full thread.