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

191
Views
filtrar una matriz de objetos que contiene pares de valores clave donde el valor es un número entero

Mi matriz se ve así

 filtervalue = xy arr = [{id:123, name:'xyz'}, {id:122, name:'xyy'}, {id:134, name:'zzz'}] arr.filter((i) => name.includes(filtervalue) );

arriba me da el resultado esperado de la siguiente manera

 [{id:123, name:'xyz'}, {id:122, name:'xyy'}]

Estoy tratando de hacer lo mismo con la identificación. me da un error

.includes no es una función.

como, cuando mi filterval = 12

la salida esperada debe ser la siguiente

 [{id:123, name:'xyz'}, {id:122, name:'xyy'}]

Cómo logro esto ?

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

0

Utilice una función de filtro como esta.

 const filtervalue = 12 const arr = [{id:123, name:'xyz'}, {id:122, name:'xyy'}, {id:134, name:'zzz'}] const result = arr.filter((val) => val.id.toString().includes(filtervalue.toString())) console.log(result)

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!