dimanche 18 novembre 2018

In Javascript: How to use if, else and prompt to ask if the user is within the age range of a prize?

Underneath is my code. And I need to figure if the user is between age range 20 and 40. If so they are qualified for a prize money.

var age = prompt("Please enter your age");// Asking for age.
if (age >= 20 || >= 40){ // Using if statement to ask if within age range. 
    alert("You are qualified for free money!");
} else {
    alert("You are not qualified for free money.");
}

What can I do different?

Aucun commentaire:

Enregistrer un commentaire