JSFiddle - React, Tailwind, and code Playground

by Stas Orekhovskiy

JavaScript

function checkAge(age) {
  if (age > 18) { 
    return true;
  } else {
    return confirm('Родители разрешили?');
  }
}

var age = prompt('Ваш возраст?');

if (checkAge(age)) {
  alert('Доступ разрешен'); 
} else {
  alert('В доступе отказано');
}