2
I got the following array object:
const cores = [
{ cor: 'amarelo', peso: 2 },
{ cor: 'amarelo', peso: 3 },
{ cor: 'verde', peso: 7 }
];
My goal is first to filter it to return only the objects with the yellow color, and this I do with:
const mani = obj.filter(spec => spec.cor === 'amarelo');
After that, I have to filter this array to return only the object with the least weight. In this case, I hope to receive the following object:
{ cor: 'amarelo', peso: 2 }
How would I do that?