Javascript examples for Array:map
Merge Multiple Column of Arrays to rows with map function
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from ww w. j ava 2 s. c o m*/ var obj = { A: [1, 2, 3], B: [4, 5, 6] } var keys = Object.keys(obj); var desiredStructure = obj[keys[0]].map(function(col,i){ return keys.map(function(_,j){ return obj[keys[j]][i] }) }); console.log(desiredStructure); } </script> </head> <body> </body> </html>