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

144
Views
¿Por qué la variable de respuesta está dando el número de índice de la matriz de saludoReply? Quiero el valor de esa matriz

 var submit = document.getElementById("submit"); var value = document.getElementById("value"); var greeting = ['hi', 'hello', 'Hlw', 'hello jii', 'hey', 'helo', 'hi there', 'hey'] var greetReply = ['hlw', 'kisu na', 'gaan shuni']; submit.addEventListener('click', () => { const reply = Math.floor(Math.random() * greetReply.length); // random reply! for (let i = 0; i < greeting.length; i++) { if(value.value === greeting[i]){ console.log(reply) } } })

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

0

debe acceder al valor de la matriz por el número de índice, intente modificar esta línea:

 console.log(greetReply[reply])

about 4 years ago · Juan Pablo Isaza Report

0

la respuesta es un índice aleatorio de greetReply para obtener el valor de ese índice, utilícelo de esta manera greetReply[reply]

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!