I have an array of objects that I need to transform into objects with key names which is {key}{index)
const input = [
{
data: 'Abc',
quantity: '1'
},
{
data: 'Def',
quantity: '2'
},
// ...
]
Below is an example of the output where the index would be appended to the key name which results in data1, quantity1, data2, quantity2..
const output = { data1: 'Abc', quantity1: 1, data2: 'Def', quantity2: 2 }