Some of the examples in our textbook, Fundamentals of Web Development, use the document.write function to add information to an HTML document. Using document.write is okay for small examples like that, but you should not use it in your assignment or project code. Instead, use DOM (Document Object Model) functions or the innerHTML property. You can read about using the innerHTML property in the Generating HTML section below.
You can see an example of generating HTML with a detailed explanation on these
• genSampleNotes.html A walk-through of genSample.html and genSample.js