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

177
Views
¿Cuál es la sintaxis adecuada para javascript?
var age = prompt("Enter your age"); if (age < 18){ alert("Sorry, you are too yound to drive this car. Powering off"); } else if (age > 18){ alert("Powering On. Enjoy the ride!"); } else if(age == 18){ alert("Congratulations on your first year of driving. Enjoy the ride!"); }

o

 var age = prompt("What is your age?"); if (Number(age) < 18) { alert("Sorry, you are too yound to drive this car. Powering off"); } else if (Number(age) > 18) { alert("Powering On. Enjoy the ride!"); } else if (Number(age) === 18) { alert("Congratulations on your first year of driving. Enjoy the ride!"); }

¿Cuál de la sintaxis es mejor? y por qué?... en relación con la condición booleana de la instrucción if/else...if

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Esa no es una cuestión de sintaxis, el código que proporcionó es bueno en todos los casos. Sin embargo, si desea un resultado preciso y un código limpio, debe transformar el resultado solicitado en un número. Tenga en cuenta que Javascript es un lenguaje de tipo dinámico, por lo que si el número como una cadena se compara con un número, ambos se compararán como una cadena.

about 4 years ago · Santiago Trujillo 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!