I am wanting to use map to create a new array of of objects that have two properties from the original objects in the originating array, so I am trying this:
const filteredConfigurableModules = configurableModules.map(module =>
module.name, module.configurables
);
But this isn't working, as only the "name" is saved to the new array. What am I missing here?
I also tried this:
const filteredConfigurableModules = configurableModules.map(module => {
name: module.name,
configurables: module.configurables
});
... but end up with a syntax error:
SyntaxError: Unexpected token ':'
{}. TryconfigurableModules.map(module =>({ module.name, module.configurables })).