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

157
Views
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
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!