Javascript get current year

const currentYear = new Date().getFullYear();
console.log(currentYear);

Step 1: Create a constant variable called "currentYear". Step 2: Use the "Date()" object to get the current date and time. Step 3: Call the "getFullYear()" method on the "Date()" object to retrieve the current year. Step 4: Print the value of "currentYear" to the console.