I'm attempting to multiply two arrays that are the same length and generate a third array from it.
After experimenting with loops, I believe using a nested loop is the most effective approach.
Here is my initial implementation, which unfortunately multiplied out the entire array:
var one = [1, 2, 3, 4, 5];
var two = [1, 2, 3, 4, 5];
//var partOne = one.length
var partOne = []
for(var i=0; i<one.length;i++) {
for(var j=0;j<two.length;j++) {
partOne.push({value:one[i] * two[i]});
}
}
I am aiming for something akin to this example below:
var a = [3, 5]
var b = [5, 5]
//answer
var c = [15, 25]