Here are three sets of data:
let firstData = [ {key: value1}, {key: value2}, {key:value3} ]
let secondData = [ {key: value1}, {key: value2}, {key:value3}, {key: value4} ] //same structure, different values
let thirdData = [ [1,1,1,1], [1,1,1,1], [1,1,1,1] ]
I am looking for a specific data structure like this:
result = {
firstData[0][key] : {
secondData[0][key2] : thirdData[0][0],
secondData[0][key2] : thirdData[0][0],
secondData[0][key2] : thirdData[0][0]
}
I attempted to create the desired structure as follows but encountered issues:
let result = {};
firstData.map( (d, i) => {
thirdData[i].map(
(x,idx) => (
result[d.key] = {
secondData[i]['key'] : x
}
)
)
})