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

74
Views
control of two var JAVASCRIPT

I do not have a DB

how can I compare the values ​​taken from the keyboard with those contained in the const?

how can I do to continue in the site only if the input value matches one of those in the const?

this is the JS code:

enter code here

console.log('ciao benvenuto nella console');

var nomeUtente = window.prompt ("Inserisci il tuo User");

const nomi = [Lorenzo, Angelo, David]

console.log(nomi.includes(nomeUtente))




if (nomeUtente == nomi){
alert('Bentornato ' + nomeUtente +  ' fai click su ok per entrare nel sito');
}

else {
alert('Nome utente errato')
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need to save your user names as strings in the array. Then check if the array includes the user input.

console.log('ciao benvenuto nella console');

var nomeUtente = window.prompt ("Inserisci il tuo User");

const nomi = ['Lorenzo', 'Angelo', 'David']

if (nomi.includes(nomeUtente)){
  alert('Bentornato ' + nomeUtente +  ' fai click su ok per entrare nel sito');
  console.log(false);
}

else {
  alert('Nome utente errato')
  console.log(true);
}

about 4 years ago · Juan Pablo Isaza 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!