Looking to create a new object with updated key-value pairs?
let input= {
"Bhang Seeds": 120,
"CRON": 300,
"F1 Hybrid": 180,
}
Here's the expected output:
[
{
variety: 'Bhang Seeds',
Quantity:180
},
{
variety: 'CRON',
Quantity:300
},
{
variety: 'F1 Hybrid',
Quantity:180
}
]
I've managed to separate keys and values, but how do I return them with new key-value pairs?
const varietyKey = Object.keys(response).map(v => v);
console.log(varietyKey);
const varietyValue: any = Object.values(response).map(v => v);
console.log(variety);