GroupBy

GroupBy returns a sequence of objects that match the key value for the grouping.

JavaScript (Reduce)

var result = persons.reduce((previous, person) => {
    (previous[person.lastname] = previous[person.lastname] || []).push(person);
    return previous;
}, []);