Js if you have the same object in two arrays, add attributes to the object.

[{id:"11"}, {id:"22"}, {id:"33"}] [{id:"11"}, {id:"33"}]
want the following results
[
{id:"11",follwed:true},
{id:"22",follwed:false},
{id:"33",follwed:true}
]

Jul.13,2021

var arr1 = [{id:'11'},{id:'22'},{id:'33'}];
var arr2 = [{id:'11'},{id:'33'}];
var arr = arr1.concat(arr2);
var obj = {}
var newArr = arr.reduce((pre, cur) => {
    obj[cur.id] ? '' : obj[cur.id] = true && pre.push(cur);
    return pre
}, [])
console.log(newArr)
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-1b3af5a-2c270.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-1b3af5a-2c270.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?