Why document.writeln is considered bad practice

When debugging JavaScript code on pages Console sometimes complains about the use of document.writeln().

I used this in my footer to echo the date and time that the page was last changed. I also don't know why the document.writeln() only works if it enclosed within comment code and on a new line.

The code that I changed:

A HREF="#top"><<CRIPT><!--

was change to:

document.getElementById("code").innerHTML = document.lastModified;

In addition if you click on the top-most code snippet it will change the section heading text. Also notice that the cursor will change to a pointer if placed over the snippet.


External Sources

Is write(ln) bad? - January 2021