1<div class="copyright">
2 <footer>Copyright © <span id="year"></span> , All rights reserved to X</footer>
3</div>
4<script>
5
6 function getCurrentYear() {
7 return new Date().getFullYear(); // returns the year via local timing
8 };
9
10 document.getElementById("year").innerHTML = getCurrentYear();
11 //changing the inner html of the span with "year" id to the given year(2021)
12</script>