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

260
Views
How to take out unique key value pairs with it's other values as well

Help me in taking out unique fruit without reducing it's repeat count ?

I've been trying to arrange this array in an order to take out the same fruit name objects to a seperate array.

I am trying to get something like this :

 [{fruit:'apple',id:2},{fruit:'apple',id:6},{fruit:'apple',id:5},{fruit:'apple',id:6},{fruit:'apple',id:9},{fruit:'grape',id:3},{fruit:'grape',id:10},{fruit:'orange',id:4},{fruit:'orange',id:8},{fruit:'banana',id:7},{fruit:'banana',id:11}]

From the array

const arr=  [{fruit:'apple',id:2},{fruit:'grape',id:3},{fruit:'orange',id:4},{fruit:'apple',id:5}, 
           {fruit:'apple',id:6},{fruit:'banana',id:7},{fruit:'orange',id:8}, 
          {fruit:'apple',id:9},{fruit:'grape',id:10},{fruit:'banana',id:11}]
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!