alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

JavaScript find array of String and Array Object without duplicates ?

JavaScript find array of String and Array Object without duplicates ?

You can use lodash chain to solve that:

 const result = _([...arr1, ...arr2.map(i => i.email)]) // ['test@email', 'test2@email', 'test@email']
    .countBy() // { test@email: 2, test2@email: 1 }
    .pickBy(count => count === 1) // { test2@email: 1 }
    .keys() // ['test2@email']
    .value();

252 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online