I have two array as
a1 = ['test1@gmail.com','test2@gmail.com','test3@gmail.com'];
a2 = [{email: 'test1@gmail.com'},{email: 'test2@gmail.com'}];
Now I want to get difference between these two array mentioned above as
resultDifference = ['test3@gmail.com'];
How to achieve this difference result by using lodash only.
>Solution :
You should add what you have tried to your post
const a1 = ["test1@gmail.com", "test2@gmail.com", "test3@gmail.com"];
const a2 = [{ email: "test1@gmail.com" }, { email: "test2@gmail.com" }];
const ans = _.difference(
a1,
a2.map((a) => a.email)
);