195
rated 0 times
[
199]
[
4]
/ answers: 1 / hits: 27950
/ 6 Years ago, mon, march 5, 2018, 12:00:00
I have this array:
rows = [ [ 89, 18, 9 ], [ 1903, 3, 4 ], [ 3, 1, 800 ] ];
It should look like this:
[ [ 89, 1903, 3 ], [ 18, 3, 1 ], [ 9, 4, 800 ] ]
And the code, that is working, looks like this:
rows[0].map((_, columnIndex) => rows.map(
row => row[columnIndex])
);
How does this work?
More From » javascript