I want to do it with the forEach loop but I can't do it, what I want to do is the following
For example i have the first array:
let numbersA = [4,5,6,7,8];
Then i have the last array:
let numbersB = [2,3,4,5,6];
The expected output:
4 * 2 = 8
4*3 = 12
4 * 4 = 16
4 * 5 = 20
4 * 6 = 24
and now comes the second multiplication of the first array of the second number:
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
How can I get this result, I want to do it with the forEach loop, using arrow functions but I got stuck
forloops. You can do the exact same thing with.forEach()too, but that can cause problems in some rare senarios. If you absolutely need to use.forEach(), then tryarray1.forEach(item1 => array2.forEach(item2 => doSomething(item1 * item2)))