I have a belwo collection of objects assigned in
products:{id: null, name: 6801},
{id: null, name: 6802},
{id: null, name: 6805}
I need to use map function and iterate the name need to convert into array of strings.
current code is written in 0 : {names: 6197} 1 : {names: 6801} 2 : {names: 6802}
but i need the below format
names:[6802,6802,6805],
products.map(({name: names}) => ({names}));
let names = products.map(p => p.name);p => p.name? If you need destructuring you would do({name: n} => n). What is the point of this question?0 : {name: 6197} 1 : {domicile: 6801} 2 : {name: 6802}