+ 1

What's the difference between console.log and document.write

I don't understand them

8th Nov 2017, 1:31 PM
Esiro Davies
Esiro Davies - avatar
3 Réponses
+ 15
Console.log outputs to the javascript console. document.write writes to the current html document erasing previous elements. https://developer.mozilla.org/en/docs/Web/API/Console/log Console.log() - Web APIs | MDN https://www.w3schools.com/js/js_output.asp JavaScript Output - W3Schools https://www.w3schools.com/jsref/met_doc_write.asp document.write() - W3Schools https://developer.mozilla.org/en-US/docs/Web/API/Document/write Document.write() - Web APIs | MDN
8th Nov 2017, 1:34 PM
Lord Krishna
Lord Krishna - avatar
+ 2
Thanks
8th Nov 2017, 1:35 PM
Esiro Davies
Esiro Davies - avatar
+ 1
console.log brings in the browser console, and document.write to the page
8th Nov 2017, 1:34 PM
Evgeniy
Evgeniy - avatar