0
JS, can someone explain the difference..
there are console.log and document.write what is the difference between them, and why when you write document.write instead of console.log this is considered a bug in the code trainer? im so tired of it, i dont get it 😭😭😭
1 Resposta
+ 7
console.log() writes a log message into the Javascript console instead of the document/page.
document.write() overwrites the content of the document that is currently loaded. Its usage was considered bad practice because it overwrites/replaces the page content entirely.
It is considered better to update parts of the document e.g. to change an element's text or value (or other attributes as necessary) rather than to overwrite everything.