Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda