var age = prompt("please enter your age")
var letters = /^[A-Za-z]+$/;
if (age == 18) {
alert("welcome to our website")
}
if (age > 18) {
alert("welcome to our website")
}
if (age < 18) {
alert("you aren't allowed to visit this website")
window.close()
}
if (age = letters) {
alert("please enter a valid number")
prompt("please enter your age")
}
samedi 24 novembre 2018
A simple JavaScript If query. If one "if" is used I don't want the others to be used. If I type 18 the following answers from the other ifs show up
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire