I have an array with items and I want to make something like this:
(until have items in array )
So you have pairs of elements which you want to return from a .map. The easiest way to do this is to just wrap them in an array. {data.map(function(x, i){ return [ {x[0]}, {x[1]} ]; })} Don't forget the comma after the first .
elements which you want to return from a .map. The easiest way to do this is to just wrap them in an array. {data.map(function(x, i){ return [ {x[0]}, {x[1]} ]; })} Don't forget the comma after the first
.map
{data.map(function(x, i){ return [ {x[0]}, {x[1]} ]; })}
Don't forget the comma after the first