I have an arrays:
a = [1, 1, 1, 1]
Which should be merged with an array of arrays:
b = [[0],[0],[0],[0]]
To form a third:
c = [[0,1],[0,1],[0,1],[0,1]]
One way I have thought would be to run a .forEach on a and concatenate to each object of b. however, I'd like this so the list may become longer with, for example d=[2,2,2,2] creating e=[[0,1,2],[0,1,2],[0,1,2],[0,1,2]].
a = [1, 1, 1, 1];
b = [[0],[0],[0],[0]];
a.forEach((number,index) => {
b[index] = b[index].concat(number)
});
console.log(b);
Thanks!