In tutorials I've learnt to use document.write
. Now I understand that by many this is frowned upon. I've tried print()
, but then it literally sends it to the printer.
So what are alternatives I should use, and why shouldn't I use document.write
? Both w3schools and MDN use document.write
.
As a recommended alternative to document.write
you could use DOM manipulation to directly query and add node elements to the DOM.