var age = prompt("How old are you??")
if(age < 18)
{
}
else
{
}
I was just wondering how I make this JavaScript code either redirect to a different page or allow the user to continue on the page they clicked, if of aged.
var age = prompt("How old are you??")
if(age < 18)
{
}
else
{
}
I was just wondering how I make this JavaScript code either redirect to a different page or allow the user to continue on the page they clicked, if of aged.
if(age < 18) {
window.location.href = 'not-old-enough.html';
} else {
// Do nothing
}
if (age < 18) {
window.location.href = 'not-old-enough.html';
} else {
return false;
}