Elements that extract the same attribute values from an array are rearranged into a new array

has the following array

[{
    "id": "49088",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23749",
    "title":"demo-title1"
},{
    "id": "49089",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23749",
    "title":"demo-title2"
},{
    "id": "49090",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23750",
    "title":"demo-title3"
},{
    "id": "49091",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23751",
    "title":"demo-title4"
},{
    "id": "49092",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23751",
    "title":"demo-title5"
},{
    "id": "49093",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23752",
    "title":"demo-title6"
}]

needs to be converted to this format

[
    [{
        "id": "49088",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23749",
        "title": "demo-title1"
    }, {
        "id": "49089",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23749",
        "title": "demo-title2"
    }], {
        "id": "49090",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23750",
        "title": "demo-title3"
    },
    [{
        "id": "49091",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23751",
        "title": "demo-title4"
    }, {
        "id": "49092",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23751",
        "title": "demo-title5"
    }], {
        "id": "49093",
        "user_id": "8733",
        "user_name": "echo",
        "order_id": "23752",
        "title": "demo-title6"
    }
]

that is, the elements of the original array with the same order_id are merged into a new array and added to the original array. Please give me some advice.

Oct.09,2021

var arr = [{
    "id": "49088",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23749",
    "title":"demo-title1"
},{
    "id": "49089",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23749",
    "title":"demo-title2"
},{
    "id": "49090",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23750",
    "title":"demo-title3"
},{
    "id": "49091",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23751",
    "title":"demo-title4"
},{
    "id": "49092",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23751",
    "title":"demo-title5"
},{
    "id": "49093",
    "user_id": "8733",
    "user_name": "echo",
    "order_id": "23752",
    "title":"demo-title6"
}]

var result = []
var temp = {}
for (let item of arr) {
  if (!temp[item.order_id]) {
    temp[item.order_id] = []
    result.push(temp[item.order_id])
  }
  temp[item.order_id].push(item)
}
console.log(result)
Menu