I have an Array of objects like this :
let cars = [
{
"color": "purple",
"type": "minivan",
"registration": new Date('2017-01-03'),
"capacity": 7
},
{
"color": "red",
"type": "station wagon",
"registration": new Date('2018-03-03'),
"capacity": 5
},
{
...
},
...
]
I want to make a change on all objects and return this array without unnecessary information ( I don't need to get the type and registration ) and have my array of objects like this:
let cars = [
{
"color": "purple",
"capacity": 7
},
{
"color": "red",
"capacity": 5
},
{
...
},
...
]
cars.map(({color,capacity}) => ({color, capacity}))