+ 2
Document.write or console.log which is more useful
Java script
1 Answer
+ 5
console.log is more useful.
console.log is useful for troubleshooting although it is best removed before releasing a production ready version of your code. console.error is also helpful for troubleshooting.
I never used document.write in any paid project. HTML is great for defining the initial state of a document. There's no frequent need to write HTML in JavaScript before the HTML loads. After the document loads, there are very good ways to manipulate the document model using JavaScript. There just isn't any cases I can think of for document.write.