[Solved] How to compare each object in an array with each other. When found update the object with a new property


You can use newCollection or manipulate in the collection like this

collection.forEach((item)=>{
item.rowMatch = (collection.filter((e)=>{return (e.name==item.name&&e.phone==item.phone)}).length>1)?'true':'false';
})
console.log(collection)

Simple is that.Here is working JSFiddle for it https://jsfiddle.net/touqeer/pgdsw9Le/1/ .

11

solved How to compare each object in an array with each other. When found update the object with a new property