What is the problem of merging javascript multi-dimensional arrays?

            var arr = [{
                id: 1,
                name: "a"
            }, {
                id: 1,
                name: "b"
            }, {
                id: 2,
                name: "c"
            }, {
                id: 2,
                name: "d"
            }];

implementation result:

arr = [{
                id: 1,
                name: ["a", "b"]
            }, {
                id: 2,
                name: ["c", "d"]
            }];

could you tell me how to achieve this?

Mar.21,2021

  

my sentence is a bit less readable, for reference:
arr.reduce ((mjournal c) = > [m.find (x = > x.id=c.id) .name.push (c.name), m] [1], Array.from (new Set (arr.map (n = > n.id)), m = > new Object ({id:m,name: []});

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea7eae-5ccb0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea7eae-5ccb0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?