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

223
Views
La parte del aviso funciona pero no las condiciones if-else dentro de la función. ¿Qué hice mal?

Estoy tratando de mostrar una alerta que dice qué tipo de triángulo es con las entradas del aviso, pero las condiciones si no funcionan cuando lo coloco dentro de una función. Si no está dentro de una función, funciona bien, pero es un requisito ponerlo dentro.

intenté esto y solo funciona la parte del aviso

 <!DOCTYPE html> <html> <body> <script> var a = prompt("Enter the length of side A: "); var b = prompt("Enter the length of side B: "); var c = prompt("Enter the length of side C: "); function determineTriangle(a, b, c) { if (a == b && b == c){ window.alert("The triangle is EQUILATERAL") } else if (a == b || b == c || c == a){ window.alert("The triangle is ISOSCELES"); } else{ window.alert("The triangle is SCALENE"); } } </script> </body> </html>

Me he encontrado con un nuevo problema. Necesito usar la función isNan() para verificar si la entrada es un número y agregué esta parte

 <!DOCTYPE html> <html> <body> <script> var a = prompt("Enter the length of side A: "); var b = prompt("Enter the length of side B: "); var c = prompt("Enter the length of side C: "); if (isNan(a)) { window.alert("You did not enter a number") } else { determineTriangle(a, b, c) } if (isNan(b)) { window.alert("You did not enter a number") } else { determineTriangle(a, b, c) } if (isNan(c)) { window.alert("You did not enter a number") } else { determineTriangle(a, b, c) } function determineTriangle(a, b, c) { if (a == b && b == c){ window.alert("The triangle is EQUILATERAL") } else if (a == b || b == c || c == a){ window.alert("The triangle is ISOSCELES"); } else{ window.alert("The triangle is SCALENE"); } } determineTriangle(a, b, c); </script> </body> </html>

y no vuelve a funcionar.

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!