showing results for - "group items of list by proprety value js"
Catalina
10 Nov 2020
1function groupBy(collection, property) {
2    var i = 0, val, index,
3        values = [], result = [];
4    for (; i < collection.length; i++) {
5        val = collection[i][property];
6        index = values.indexOf(val);
7        if (index > -1)
8            result[index].push(collection[i]);
9        else {
10            values.push(val);
11            result.push([collection[i]]);
12        }
13    }
14    return result;
15}
16
17var obj = groupBy(list, "group");
18
19
20//https://stackoverflow.com/questions/21776389/javascript-object-grouping