Reputation: 51
Let's say I have 2 individual arrays that consists of lat and long values respectively.
lat = [23,34,25];
long = [11,12,13];
My question is how do i create output of combined lat and long arrays above to :
combined_latlong = [ [23,11] , [32,12], [25,13] ];
Upvotes: 0
Views: 48
Reputation: 4380
You can use map()
const lat = [23, 34, 25];
const long = [11, 12, 13];
const result = lat.map((l, i) => [l, long[i]]);
console.log(result);
Upvotes: 2