How to merge objects in js array

var list= [{id:1,number:2,title:2}, {id:1,number:3,title:2}]
if the values of id and title in the array are the same, and the two objects in the array are merged and the numbered values are added, how to achieve
and finally get [{id:1,number:5,title:2}]

Mar.13,2021

var list=[{id:1,number:2,title:2},{id:1,number:3,title:2}]
function merge (list) {
  let result = []
  let cache = {}
  list.forEach(item => {
    let key = `id:${item.id},title${item.title}`
    let index = cache[key]
    if (index !== undefined) {
      result[index].number += item.number
    } else {
      result.push(Object.assign({}, item))
      cache[key] = result.length - 1
    }
  })
  return result
}

merge(list)

lodash cloneDeep method

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-1eaf38e-4801d.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-1eaf38e-4801d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?