installation npm install array-transpose Use file : test.js var transpose = require('array-transpose') var a = [ [1, 2, 3], [4, 5, 6] ] console.log(transpose(a))