Tell us what’s happening:
hi guys, don’t understand what means the orders which I uploaded.
Your code so far
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;
}
multiplyAll([[1,2],[3,4],[5,6,7]]);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5
.
Challenge: Nesting For Loops
Link to the challenge:
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
ilenia
January 2, 2021, 12:38pm
2
can you rephrase in a different way? I don’t understand what you are asking
yes sure:
multiplyAll([[1],[2],[3]])
should return 6
multiplyAll([[1,2],[3,4],[5,6,7]])
should return 5040
multiplyAll([[5,1],[0.2, 4, 0.5],[3, 9]])
should return 54
don’t get what does it mean!
ilenia
January 2, 2021, 12:47pm
4
it is the function call with an example of arguments and the output that the function should have when called like that
1 Like
ilenia
January 2, 2021, 12:49pm
5
also note that this is not correct,
expanding tbr shorthand syntax this is
product = product = product * arr[i][j]
you can’t use both =
and *=
, you need or one or the other, not both
1 Like
thanks for mentioning this point.
I know but I don’t get how it works. could u please explain one of them?
ilenia
January 2, 2021, 1:27pm
8
maybe review this challenge
Learn to code. Build projects. Earn certifications.Since 2015, 40,000 graduates have gotten jobs at tech companies including Google, Apple, Amazon, and Microsoft.
1 Like