I have an array of nested array of numbers and I am trying to convert it into array of object with x, y, z value.
I have the following data
[
[1, 2, 3],
[2, 3, 4],
[4, 5, 6]
]
My expected output is something like this
[
{ x: 1, y: 2, z: 3 },
{ x: 2, y: 3, z: 4 },
{ x: 4, y: 5, z: 6 }
]
I have done this but I don't think its a standard solution. Any better way anyone can suggest?
data.map((point, i) => {
return {
x: point[0],
y: point[1],
z: point[2],
}
})