I'm currently working on a task where I have an object that needs to be transformed into an array with the property as the key. The structure of the object is as follows:
{
Cat: {
value: 50
},
Dog: {
value: 80
}
}
The desired output should look like this:
[
{
animal: 'Cat',
value: 50
},
{
animal: 'Dog',
value: 80
}
]
If anyone can provide assistance, it would be greatly appreciated.
So far, I've attempted:
const animalArr = Object.entries(AnimalObj);
However, I am unsure about what steps to take next.