MaoStream MaoStream - 12 days ago 5
Javascript Question

Best way to concat two arrays in underscore

What is the bes tway to get something like this:
ar1=[1,2,3,4,5]
ar2=[a,b,c,d,e]

ar3=[[1,a],[2,b],[3,c]]?

Answer

You are looking for _.zip method.

ar3 = _.zip(ar1,ar2)

Comments