In my possession, I have an array of objects with IDs and names:
[
{
"id": 10,
"name": "comedy"
},
{
"id": 12,
"name": "documentary"
},
{
"id": 11,
"name": "scifi"
}
]
My goal is to extract only the ID values and combine them into a single array like this:
[ 10, 12, 13 ]
or
{ 10, 12, 13 }
So far, I've attempted the following code snippet:
const getIDs = value.map( ( { id } ) => ( {
id: id
} ) );
However, the result turns out to be:
[
{
"id": 10
},
{
"id": 12
},
{
"id": 11
}
]