Here is my first array:
const withSub = [[31, 32, 34, 34], [32, 36], [12], [15, 38]];
Here is my second array:
const arr = ['f', 'b', 'c', 'd'];
The number of arrays in withSub is always equal to the number of arr arrays, while the number of subarrays in withSub may be different.
I want to create a function that generates a new array based on these two arrays in such a way that the number of each element in arr must be equal to the number of subarrays in withArr.
In this example the final array must be:
['f', 'f', 'f', 'f', 'b', 'b', 'c', 'd', 'd'];