relatively new to JS, trying to understand this code which takes an array of arrays and converts its columns into arrays.
grid=
[[".",".",".","1","4",".",".","2","."],
[".",".","6",".",".",".",".",".","."],
[".",".",".",".",".",".",".",".","."],
[".",".","1",".",".",".",".",".","."],
[".","6","7",".",".",".",".",".","9"],
[".",".",".",".",".",".","8","1","."],
[".","3",".",".",".",".",".",".","6"],
[".",".",".",".",".","7",".",".","."],
[".",".",".","5",".",".",".","7","."]]
//Turn columns into rows
var transpose = grid =>
grid[0].map(
(_,c) => grid.map(
row => row[c]
)
)
How would this look using regular functions?