I have been attempting to create a function that can multiply two arrays of numbers together without using array.join("") * array2.join("")
.
I have experimented with various methods, such as:
var input = [3, 6, 4];
var scalar = 5;
var output = input.map(x => x * scalar); // [15, 30, 20]
However, this method only works for multiplying each number in the array by a single scalar value.
I am seeking a function that can achieve the following:
var array = [1, 3, 2];
var array2 = [5, 3, 8, 2, 3, 5, 2];
someFunction(array, array2);
// [7, 1, 0, 4, 7, 0, 4, 6, 4]
Please take note: I do not want the solution to involve something like
array.join("") * array2.join("")
I am willing to offer all my reputation points as a bounty to anyone who can provide a satisfactory answer to my query.