De-duplication of objects in js array

the requirement is: if the name of the array is the same, compare which timestamp, is larger to retain which, and remove the smaller one. The array is as follows:

var arr = [
    {name: "", timestamp: 1537243392},
    {name: "", timestamp: 1537243369},
    {name: "", timestamp: 1537243411},
    {name: "", timestamp: 1537243241},
    {name: "", timestamp: 1537243204},        
];

the desired array result is:

var finalArr = [
    {name: "", timestamp: 1537243392},
    {name: "", timestamp: 1537243411},
    {name: "", timestamp: 1537243241},
    {name: "", timestamp: 1537243204},        
];
Jun.30,2021

an original version

var arr = [
    {name: "", timestamp: 1537243392},
    {name: "", timestamp: 1537243369},
    {name: "", timestamp: 1537243411},
    {name: "", timestamp: 1537243241},
    {name: "", timestamp: 1537243204},
];

var obj = {};
----v1
arr.forEach(v=>{
    obj[v.name] = v;
});

---v2 timestamp;
arr.forEach(v => {
    if (obj[v.name]) {
        if (obj[v.name].timestamp < v.timestamp) {
            obj[v.name] = v;
        }
    } else {
        obj[v.name] = v;
    }
});
console.log(Object.values(obj));





arr.sort((a,b)=>{
  var v1=a.name
  var v2=b.name
  if(v1==v2){
    return b.timestamp-a.timestamp
  }
  return v2-v1
})
console.log("11",arr)
var obj=[]
arr = arr.reduce((cur,next) => {
    obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
    return cur;
},[]) //cur
console.log(arr);
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-1b30524-2b481.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-1b30524-2b481.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?