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

182
Views
How to use filter method and find method at the same time?

I want to use filter method and find method at the same time to sort, but it doesn't work well.

const nums = [
    17022,
    17027
]

const coupons = [
    {
        "coupon_id": 17022,
    },
    {
        "coupon_id": 17022,
    },
    {
        "coupon_id": 17024,
    },
    {
        "coupon_id": 17025,
    },
    {
        "coupon_id": 17026,
    },
    {
        "coupon_id": 17027,
    }
]

What I'm trying to is

couponsNew = coupons.filter(coupon => {
  return nums.find(id => coupon.coupon_id !== id)
})

to get couponsNew that coupon_id is not 17022, 17027.

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

0

Try This

const data = coupons.filter((d)=> !nums.includes(d.coupon_id));
console.log(data);
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!