So, I was making the footer for my website just now and I wanted to make the year shown on the footer always be the current year. I need to use JavaScript, so I wrote some code for it:
function loadCopyrightText() {
var today = new Date();
var year = today.getFullYear();
}
But now I have a problem. I want to show the variable year
as a string like this:
“2019”
I researched the Number.toString()
method and it did not solve the problem.