var x = [[1, 2],[3, 4],[5, 6]]; var y = []; var temp = []; var i = 0; while ( i < x[0].length) { var c = 0; while ( c < x.length ) { y[c] = x[c][i] ; c++ } //console.log(y); temp.push(y); i++ } console.log(temp);