freeCodeCamp Challenge Guide: Nesting For Loops - #20 by thelynguist - Guide - The freeCodeCamp Forum
Nesting for loops - multiplying
Nesting for Loops
Nesting For Loops freeCodeCamp
Videos
Stumped on this challenge and looking for clarification on something I'm having trouble understanding (not looking for the answer!
Screenshot of AssignmentThe challenge is to 'Modify function multiplyAll so that it multiplies the product variable by each number in the sub-arrays of arr'
What confused me here is that there is no 'subarrays of arr'.
The only thing with arrays in this box on the fight is 'multiplyAll', which doesn't factor into the solution here except for testing.
What do they mean here?
There are sub arrays in the default parameter passed to multiplyAll, it's passed multiplyAll([[1,2],[3,4],[5,6,7]]); in the code. That's an array that contains 3 sub arrays.
You need to modify the function so it does what is asked and returns the result, the exercise is setup technically that when you press the run tests buttons it will take care of sending your function proper test data (2D arrays). They come to you in the shape of the arr variable in multiplyAll. arrwill be an array with sub arrays.
Does that make sense?
The nested array is passed in as a function parameter when the multiplyAll function is called on line 10.