I have following array:
[ [val1, val2] [val1, val2] [val1, val2] [valN, valN] ]
N represents the fact that the
N
Using ES6 you can write this in a very concise way:
var arrs = [ [1, 2], [3, 4], [5, 6], [7, 8] ]; const locations = arrs.map(([lat, lng]) => ({lat, lng})); console.log(locations);