set22

Group orders by status for a dashboard

22 / 26
read the snippet · pick its Big-O
function groupByStatus(orders) {
return orders.reduce((acc, o) => {
(acc[o.status] ||= []).push(o);
return acc;
}, {});
}