How to turn this: [[a1, b1], [a2, b2]] into this? [{x1: a1, y2: b1}, {x2: a2, y2: b2}]?
Note: the x1 and x2 are newly defined properties (with a1, b1, etc. as values).
Note: This is what I tried:
formatData.map((data, index) => {
const obj = {
dataX: data[index][0],
dataY: data[index][2]
}
data = obj
}
But became stuck.