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

148
Views
If-statement: importa la respuesta de una función anterior ()

Queremos importar la respuesta de la función animal al estado-si, ¿cómo hacemos eso?

 const animal = (msg) => { questionNumber++; botReply(`Nice to meet you ${msg}. Do you like pandas, elefants or koalas?`); inputWrapper.innerHTML = ` <button id="tiger">Tiger</button> <button id="elefants">Elefants</button> <button id="bears">Bears</button> `; document .getElementById("tiger") .addEventListener("click", () => nextQuestion("tiger")); document .getElementById("elefants") .addEventListener("click", () => nextQuestion("elefants")); document .getElementById("bears") .addEventListener("click", () => nextQuestion("bears")); }; const showMenu = (type) => { questionNumber++ questionNumber++; botReply(`oh good choice ${type}? Do you like warm placese or cold?`); inputWrapper.innerHTML = ` inputWrapper.innerHTML = ` <button id="cold">Cold</button> ` `; document document .getElementById("warm") .addEventListener("click", () => nextQuestion("warm")); document .getElementById("cold") .addEventListener("click", () => nextQuestion("cold")); }; const showDishSize = (type, animal) => { questionNumber++; /* Elefant */ if (type === "warm" && animal === "elefants") { botReply( `oh good choice, you like warm weather and elefants! You should go to India!"` ); } else if (type === "cold" && animal === "elefants") { botReply( `oh good choice, you like cold weather and elefants! You should go to China!"` ); } else if (type === "warm" && animal === "tiger") { /* Tiger */ botReply( `oh good choice, you like warm weather and tiger! You should go to India!"` ); } else if (type === "cold" && animal === "tiger") { botReply( `oh good choice, you like cold weather and tiger! You should go to Russia!"` ); } else if (type === "warm" && animal === "bears") { /* Bears */ botReply( `oh good choice, you like warm weather and bears! You should go to Africa!"` ); } else { botReply( `oh good choice, you like cold weather and bears! You should go to Sweden!"` ); const showDishSize = (type, animal) => { };

Gracias :)

about 4 years ago · Juan Pablo Isaza
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!