Skip to content
Prev Previous commit
Next Next commit
step2-5 done!
  • Loading branch information
EliaYazdi committed Aug 2, 2019
commit 360e39788c78e0696e916d433d95101c88f43a26
16 changes: 12 additions & 4 deletions Week3/homework/step2-5.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,22 @@ function multiplyAll(arr) {
// eslint-disable-next-line
let product = 1;

// Replace this comment and the next line with your code
console.log(arr, product);
for (let i = 0; i < arr.length; i++) {
for (let j = 0; j < arr[i].length; j++) {
product = product * arr[i][j];
}
}

return product;
}

const result = multiplyAll([[1, 2], [3, 4], [5, 6]]);

const result = multiplyAll([
[1, 2],
[3, 4],
[5, 6]
]);
console.log(result); // 720

// Do not change or remove anything below this line
module.exports = multiplyAll;
module.exports = multiplyAll;