// Prompt the user to enter their birth year
let birthYear = prompt("Enter your birth year:");
// Calculate the current year
let currentYear = new Date().getFullYear();
// Calculate the user's age
let age = currentYear - birthYear;
// Print the user's age to the console
console.log(`Your age is: ${age}`);
0 Comments