What is the difference between "console.log" and "document.write"?


#1


emphasized text

Replace this line with your code.


#2

document.write() is a legacy function for writing directly to the HTML document. Output is to the page, which the user can see. Normally a user will not see (or even be aware of) the JavaScript console. This is a debugging tool for developers to inspect their code and its running variables.

console.log() is the display function of the console. It prints plain text into the terminal. A user will not normally see this, unless they have the console open.