12.6 Homework Assignment
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Legal Activities Eligibility</title> </head> <body> <h1>Check the Console for Eligibility Results</h1> <script> // Ask the user for their age let age = prompt("Please enter your age:"); age = parseInt(age); // Convert the input to an integer // Check eligibility for various activities if (age >= 65) { console.log("You are eligible for senior citizen benefits."); } if (age >= 21) { console.log("You are eligible to drink alcohol."); } if (age >=20) { console.log("You are eligible to have religion."); } if (age >= 18) { console.log("You are eligible to vote."); } if (age >= 16) { console.log("You are eligible to drive."); } if (age < 16) { console.log("You are not eligible to drive, vote, have religion or drink."); } </script> </body> </html>
Last updated