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

254
Views
Javascript how do i dynamically find keys in my array?

I'm trying to find all the keys that are in my array to figure out if some keys already exist in there. Tho when I try to put in the keys seperate like this:

console.log(this.UrlArray.find(({color_ids}) => color_ids));

It works, but if I try doing it with the variable with the actual keys in it:

console.log(this.UrlArray.find(({prefixEqual}) => prefixEqual));

It doesn't work. The values that belong to the keys aren't important, but I stil can't figure out how to do it.

Array example:

(3) [{…}, {…}, {…}]
  0:
    bd_shoe_size_ids: Array(2)
      0: "6601"
      1: "6598"
    length: 2
    [[Prototype]]: Array(0)
    [[Prototype]]: Object
  1:
    color_ids: Array(2)
      0: "6056"
      1: "6044"
    length: 2
    [[Prototype]]: Array(0)
    [[Prototype]]: Object
  2:
    manufacturer_ids: Array(2)
      0: "5875"
      1: "5866"
    length: 2
    [[Prototype]]: Array(0)
    [[Prototype]]: Object
  length: 3
[[Prototype]]: Array(0)

I asked something like this before, but I got linkes to answers that had nothing to do with what I'm trying to do and it closed.

As desired outputs I just wanna see bd_shoe_size_ids, color_ids and manufacturer_ids when I console log it.

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

0

const data = [
    { bd_shoe_size_ids: [1, 2] },
    { color_ids: [3, 4] },
    { manufacturer_ids: [5, 6] },
];

const output = data.map(Object.keys).flat();

console.log(output);

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!