DEV Community

Anjali Gurjar
Anjali Gurjar

Posted on

groupBy

const people = [

{ name: 'John', age: 28 },

{ name: 'Jane', age: 28 },

{ name: 'Joe', age: 32 }
];
const grouped = people.groupBy(person => person.age);
// { 28: [John, Jane], 32: [Joe] }

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

šŸ‘‹ Kindness is contagious

Please leave a ā¤ļø or a friendly comment on this post if you found it helpful!

Okay