Correlates the elements of a sequence and another based on matching keys and groups them.

var createPerson = function(name) {
    return {
        name: name
    };
};

var createPet = function(name, owner) {
    return {
        name: name,
        owner: owner
    };
};

var persons = [
    createPerson("Tanja"),
    createPerson("Marcel"),
    createPerson("Yvonne"),
    createPerson("Josefine")
];

var pets = [
    createPet("Gina", persons[1]),
    createPet("Schnuffi", persons[1]),
    createPet("Schnuffel", persons[2]),
    createPet("WauWau", persons[0]),
    createPet("Lulu", persons[3]),
    createPet("Asta", persons[1])
];

// [0] 'Owner: Tanja; Pets: WauWau, Sparky'
// [1] 'Owner: Marcel; Pets: Gina, Schnuffi, Asta'
// [2] 'Owner: Yvonne; Pets: Schnuffel'
// [3] 'Owner: Josefine; Pets: Lulu'
Enumerable.fromArray(persons)
          .groupJoin(pets,
                     'person => person.name',
                     'pet => pet.owner.name',
                     function(person, petsOfPerson) {
                         var petList = petsOfPerson
                             .select('pet => pet.name')
                             .aggregate(function(result, petName) {
                                            return result += ", " + petName;
                                        });

                         return 'Owner: ' + person.name + '; Pets: ' + petList;
                     });