jeudi 12 août 2021

Prompt, Alerts, and IF statements

I am working on my very first JS project. We must use prompts that ask the user for information, and return an alert based on their answer. When I run the first IF statement, the prompt box appears, and I can enter an answer to get the alert. When I add my 2 remaining IF statements, no prompt box appears at all. I've just begun learning this material. What am I doing wrong?

var age = prompt('what is your age?');

if (age < 18) {
  alert("Wow! You are still young.");
} else if (age >= 19 && = < 23) {
  alert("Hmm, you are getting your years in.");
} else(age > 24) {
  alert("Wow, you are really old!");
}

Aucun commentaire:

Enregistrer un commentaire