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

226
Views
Creating new object from data and exclude double values

Could not find a working solution but I am creating a new object from some data inside a loop but the date contains double values so it should prevent this from adding to the new object. The name property should contain unique values only.

public listOfItems: {[key: number]: {name: string; inStock: boolean}} = {};
dataAndStuff.forEach((item, i) => {
    this.listOfItems[i] = {
        name: item.itemName,
        instock: false,
    };
});

// output
[
    {name: 'audi', inStock: true}
    {name: 'bmw', inStock: true}
    {name: 'audi', inStock: true}
    {name: 'kia', inStock: true}
]
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!