Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
how to check object property exists in array of object, find repeated property in javascript

I would like to know how to compare the object value exists in

the array of objects, then check if it is repeated and return true or false in javascript

for example, if the object value exists in mode property array object,

then check the valueid property in itemarray has duplicates

conditions to check:

if object has same valueid, mode value is FI/FD(different no duplicates) then return false

if object has same valueid, mode value is SE/SA then return true

if object has same valueid, mode has same/duplicates then return true

var obj={
   service: "SE",
   sales: "SA",
   finance: "FI",
   others: "FD"
}

var itemarray=[ 
  {name: "nemo", valueid: "abc", mode: "SE" },
  {name: "mike", valueid: "xyz", mode: "FI" },
  {name: "jim", valueid: "xyz",  mode: "FD" },
  {name: "jim", valueid: "mno",  mode: "SA" }
]



Expected Result
// same valueid, mode value is FI/FD(different no duplicates)
false


I tried
function checkRepeatedValues(){
  const getValues = itemarray.map(elm => elm.valueid);
    if (itemArray.length !== new Set(getValues).size) {
      return true;
    } else {
     return false;
   }
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!