Javascript help?!? (with prompt)?

Ok… So, I if I wanted to Prompt someone to enter their age…How could I make it if they’re under 13 don’t let them on, and if they’re old enough to let them on??? would I use if or else statements? Is it even possible?

Of course. The simplest way to do it would just be:

var age = prompt(“How old are you?”);
if (age < 13) {
    // don’t let them on; the code here will depend on your individual site
} else {
    // let them in

Leave a Reply