The array of js objects is de-duplicated by push, and the new value of push is removed, and the old value is removed.

to repeat is already implemented, but you need to remove the old value, add the new value, not replace the old value.

for example: [{abure2MagneCREV 3}, {aVl3MagneCRAV 2}], now we need to add the value of {aburete 2cecece4}, where an is the judgment field, an is all 2, they repeat, and remove the first value of the array from it, and then push a new one.

Screenshot:

clipboard.png

text code:

                    setData.push(str)
                    let obj = {};
                    setData = setData.reduce((cur,next) => {
                        obj[next.receiver] ? (cur[next.receiver] = next.receiver) : obj[next.receiver] = true && cur.push(next);
                        return cur;
                    },[]) //cur
                    console.log(setData)

The

"obj [next.permission]?" code starts from? Then there is the repeated value, how to change it

Mar.15,2021

let arr = [ { uid: 10002, msg: 'Roshan has fallen to the dire.' }, { uid: 10003, msg: 'Hello, Li Lei. I am Pang Meimo.' } ];

function update(record) {
  let index = 0;
  for(let rec of arr) {  // Search for corresponding record
    if(rec.uid == record.uid) {  // Record matched
      // Delete old record
      arr.splice(index, 1);
    }
    indexPP;
  }

  arr.push(record);
}

update({ uid: 10002, msg: 'Radiant victory!' });
// [ { uid: 10003, msg: 'Hello, Li Lei. I am Pang Meimo.' },
//   { uid: 10002, msg: 'Radiant victory!' } ]

if you don't want to be so troublesome, you can modify the storage structure. If you use vue, that seems to be the only way to do it.

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