I had two arrays that I wanted to combine in an array of arrays for coordinate storing.
const x = [1,2,3];
const y = [2,4,6];
const coords = x.map((el, index) => [el, y[index]]);
print(coords); // spits out the correct [[1,2],[2,4],[3,6]]
Now I want to do the reverse: split an array inside an array to separate arrays:
const new_coords = [[0,0],[1,4],[2,9]];
//do something
const x_new = [0,1,2];
const y_new = [0,4,9];
What would be the easiest/fastest way to accomplish this?