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

292
Views
Verifique si hay múltiples índices de matriz en react/typescript, ¿si existe uno?
if(inputData.info[0].instruction){ return ( <Text ref={instructionContainerRef} dangerouslySetInnerHTML={{ __html: replaceTextLinks(inputData.info[0].instruction) }}> </Text> ) } else { return null }

Entonces, las posibles posiciones de índice para el índice inputData.info] son 0-68. ¿Cómo puedo lograr verificar si existen datos para un índice de matriz entre 0-68, y si encuentra uno, devolver la declaración if con este índice de matriz?

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

0

Bueno, ¿qué pasa con:

 function checkItems(info, length) { return Array .from(Array(length).keys()) .map((_, i) => info[i] && info[i].instruction) .filter(item => item).length === length; } let index = 14; return checkItems(inputData.info, 68) ? <Text ref={instructionContainerRef} dangerouslySetInnerHTML={{ __html: replaceTextLinks(inputData.info[index].instruction) }}> : null;
about 4 years ago · Juan Pablo Isaza Report

0

inputData.info.find(inf => !!inf) devolverá el primer objeto que no sea nulo o indefinido.

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!