0
What's the difference between document.write and console.log. I am confused
Javascript
4 Antworten
+ 1
document.write or access to DOM elements (add nodes, update attributes/content)...
but console.log is usefull for debugging ;)
+ 1
-document.write:
It's a function to show some output (including text and html elements) on the html page (It's clear everything on the page before doing this).
-console.log:
It's a function to show some output (only text) on the console's window.
Run this example and you will understand the difference better:
https://code.sololearn.com/WsUJl31RoADt/?ref=app
0
document.write output to html document
console.log output to browser console (developpers tools)
0
So which is needed in building a website?