Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
How would you handle formatting of this simple script?

Forgive the newbie question as I am just starting a course on HTML, CSS, and Javascript but I wanted to ask a question to see how others would tackle the issue.

For instance, you have this script:

var guestList = ["Kevin", "Angela", "Mike"];

var guestName = prompt("What is your name? ");

if (guestList.includes(guestName)) {
    console.log("Welcome " + guestName);
} else {
    console.log("Not on list. " + guestName);
}

When I run it and input a name with the exact letters there are no issues. However, if I forget to capitalize the first letter then it acts as if the guest isn't on the list. My thought was to either capitalize or lowercase all letters so the computer can compare the exact strings and get a proper match. However, this doesn't feel like the right answer. I think there would be a more elegant way to code this.

So how would you prepare the data to get around this issue?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda