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

133
Views
How to compare if second object has some value in first object then return true?

I want to compare two objects as below:

First object:

const permissions = {
  "statistics":{"list":"1"},"audit":{"list":"1"}}
}

Second object:

const userPermission = 
{
  "audit":{"list":"1"}
}

So, if the second object has some value the same as the first object then return true. In this sample I want it return true. Becuase, audit has same properties.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

var obj1 = {
name:'hello',
age:12,
fav: 'fav',
foo: 'foo'
}

var obj2 = {
name: 'hey',
say: 'say',
prop: 'prop',
top: 'top'
}

var common = Object.keys(obj1).filter(obj1item =>  Object.keys(obj2).indexOf(obj1item) !== -1 );

console.log(common);

You can look into this > Is there a way to check and see if two objects have properties in common?

about 4 years ago · Juan Pablo Isaza Report
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!