Javascript transpose

Date: 2021-04-20

https://stackoverflow.com/a/36164530

transpose = m => m[0].map((x,i) => m.map(x => x[i]))

// or 
function transpose(matrix) {
  return matrix.reduce((prev, next) => next.map((item, i) =>
    (prev[i] || []).concat(next[i])
  ), []);
}

49850cookie-checkJavascript transpose