Looking to transform an array that consists of multiple arrays into a format suitable for an external API.
For example:
[ [44.5,43.2,45.1] , [42, 41.2, 48.1] ]
transforming into
[ [44.5,42], [43.2,41.2] , [45.1, 48.1] ]
My current code attempts this transformation but is not functioning as expected
var newArr= [];
var tempArr= [];
for(var key in data){
tempArr.push(finalArr[key][key])
newArr.push(tempArr)
}
Is there a simpler way to achieve this without using loops? I thought about potentially using a map function, but unsure of how to apply it here.