Sure, here is your long article:
Here is a simple script to solve the above problem:
- The today variable contains the current date.
- The getFullYear() method returns the year (four digits for dates between year 1000 and 9999) of the defined date.
Understanding the Code
Breaking down this code into steps:
First, a variable called today is assigned the current date:
var today = new Date();
var year = today.getFullYear();
Finally, we output this information in our copyright footer using document.write():
document.write('<p>© ' + year + ' My Website. All rights reserved.</p>');