I have an array of all company objects
const all= [{'text': 'first'}, {'text':'second'},{'text:': 'third'}]
And also an array of the current company
const current = [{'text:': 'third'}]
Help to leave only those "text" elements that are not duplicated in array that called "all"
I try to find solution but I miss experience
const all= [{'text': 'first'}, {'text':'second'},{'text:': 'third'}]
const current = [{'text:': 'third'}]
function test(){
const result = all.filter(el=>{
if(all.some(element=> el.text === element.text)){
return false
} else {
return true
}
})
console.log(result)
}
test()
!it is important that the search should be named by text as the id may differ