I need to reduce a JSON with objects with names and other properties down to only objects with names.
At first I used this but this resulted in a SyntaxError: Unexpected token ':'
:
data.map(m => {"name": m.name})
This works but I was wondering if there is a better way?
data.map(m => {
return {"name": m.name}
})