How do I zip two arrays in JavaScript?

I have 2 arrays:

var a = [1, 2, 3]
var b = [a, b, c]

What I want to get as a result is:

[[1, a], [2, b], [3, c]]

It seems simple but I just can’t figure out.

I want the result to be one array with each of the elements from the two arrays zipped together.

3 Answers
3

Leave a Comment