[Solved] Javascript arrays merge [closed]


Use array#map method, and use the index parameter to get the relevant element from the second array.map method return a new array

var a = ['a0', 'a1', 'a2']
var b = ['b0', 'b1', 'b2']

var c = a.map(function(item, index) {
  return [a[index], b[index]]
})
console.log(c)

1

solved Javascript arrays merge [closed]