1function groupBy(arr, prop) {
2 const map = new Map(Array.from(arr, obj => [obj[prop], []]));
3 arr.forEach(obj => map.get(obj[prop]).push(obj));
4 return Array.from(map.values());
5}
6
7const data = [{ name: "Display", group: "Technical detals", id: 60, value: 4 }, { name: "Manufacturer", group: "Manufacturer", id: 58, value: "Apple" }, { name: "OS", group: "Technical detals", id: 37, value: "Apple iOS" }];
8
9console.log(groupBy(data, "group"));