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

164
Views
¿Cómo verificar que un elemento esté presente en qué matriz en javascript?

Tengo dos 3 matrices únicas:

 const a =["b","c","d"]; const b = ["ab","cd","ef"] const c = ["abc", "cde","fgh"]

con array.includes("ab") podemos averiguar que está en b array. pero si tomamos abc y queremos buscar en qué nombre de matriz está presente.

Cómo puedo hacer eso

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

0

aquí hay una manera

 const a =["b","c","d"]; const b = ["ab","cd","ef"] const c = ["abc", "cde","fgh"] const find = (needle, haystack) => Object.entries(haystack).find(([k,v])=>v.includes(needle))[0]; console.log(find('ab', {a, b, c})) console.log(find('abc', {a, b, c}))

por supuesto, esto devuelve una cadena, que es casi inútil para luego acceder a la matriz de una manera significativa, pero esto responde a la pregunta

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!