In JavaScript How to check array values exists in array of object without duplication

I have an array

let names = ['Devid', 'Aries','James'];

and an array of object

let details = [
{"Name":"John"},
{"Name":"Devid"},
{"Name":"Aries"},
{"Name":"Aries"}
];

I want to check all names exist in detail also they are not duplicate by name in 1 loop If duplicate values exist then count it as 1 Output should be count= 2 but my code is returning count 3

 let names = ['Devid', 'Aries','James'];

 let details = [
    {"Name":"John"},
    {"Name":"Devid"},
    {"Name":"Aries"},
    {"Name":"Aries"}
    ];

let count = 0;

for (var eachDetail of details) {
     // checking here Name exist
     let isNameFound = names.some(el => eachDetail.Name.includes(el));
            if (isNameFound) count++;
        }
console.log(count);

// console.log(3) expected output 2

Output Should be 2 (As Devid and Aries) exist

Answer

You could simply iterate over the names array and perform a details.find(...) operation. If you find the object in details, add it to the resulting list.

let names = ['Devid', 'Aries','James'];

let details = [
  {"Name":"John"},
  {"Name":"Devid"},
  {"Name":"Aries"},
  {"Name":"Aries"}
];

let result = [];
names.forEach(name => {
  const object = details.find(detail => detail.Name === name);
  if (object) {
    result.push(object);
  }
});

console.log(result.length + ' entries found:');
console.log(JSON.stringify(result, null, 2));