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

181
Views
Obtener "indefinido no es un objeto" en una matriz validada

Estoy tratando de acceder a una matriz dentro de un objeto que viene en una respuesta:

 getMatches().then((matches) =>{ let possibleDraws = [] console.log(matches) console.log(typeof matches) matches.forEach(match => { if(isPossibleDraw(match)){ possibleDraws.push(match) } console.log(match.homeForm) }) console.log(possibleDraws)}).catch((err) =>{ console.log(err)})

console.log(matches) devuelve correctamente una matriz con un solo valor para fines de prueba:

 0: awayForm: (4) ['L', 'D', 'W', 'D'] awayTeamID: 15994 awayTeamName: "Maritzburg United U23" homeForm: (4) ['L', 'D', 'W', 'D'] homeTeamID: 15990 homeTeamName: "Chippa United U23" leagueID: 734 matchID: 793855 season: 2021 [[Prototype]]: Object length: 1 [[Prototype]]: Array(0)

Sin embargo, al acceder a match.homeForm , devuelve "Undefined is not an object", incluso cuando existe match.homeForm (según el último archivo console.log). Incluso me burlé de la respuesta de getMatches() a la misma matriz (la función original llama a una API y obtiene la respuesta como una promesa) y funciona perfectamente bien, así que realmente no tengo idea de lo que podría estar pasando aquí.

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

0

si intenta match[homeForm] o match['homeForm'] , ¿funciona?

además, si se trata de una matriz, debe seleccionar las matches[0]

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!