Declaring Age

hello guys, i need some help,
using javascript what code/syntax can i use to declare the minimum age of users that can register to an account is 18years old above. thanks in advance.

Here’s a simple piece:

if (age >= 18) {
    /* allow access */

else {
    /* don't allow access*/
1 Like

If you use javascript to allow/deny access, what do you want to happen if someone has JS switched off?

Unless there is a server side check to handle it then either way will presumably break the law - either by allowing access to young people or not allowing access to disabled people.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.