Three ways you can find the largest number in an array using JavaScript
Sonya Moisset
1.4K27

groups.reduce((agg, group) => {
agg.push(group.sort().pop());
return agg;
}, []);

This was my first thought.

Like what you read? Give Ben Saff a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.