I have an object:
[
{
"id": 10,
"name": "comedy"
},
{
"id": 12,
"name": "documentary"
},
{
"id": 11,
"name": "scifi"
}
]
I need to take only the id
values and add them into 1 array like so:
[ 10, 12, 13 ]
or
{ 10, 12, 13 }
I am trying:
const getIDs = value.map( ( { id } ) => ( {
id: id
} ) );
But it creates:
[
{
"id": 10
},
{
"id": 12
},
{
"id": 11
}
]