+ 1

what is difference between console.log and document.write?

23rd Jul 2017, 11:50 AM
Jibin Thomas
Jibin Thomas - avatar
3 Answers
+ 8
Developers use console.log() for logging useful info. document.write modifies what user sees in the browser by adding additional content to DOM.
23rd Jul 2017, 12:19 PM
mexikodro thanksgiving samples 1/1
mexikodro thanksgiving samples 1/1 - avatar
+ 2
console.log method is used to print text to the console, and document.write essentially adds text to the page. for example, go onto a browser, open up inspect element, go into the console tab and at the prompt write console.log(“hi”); and then write document.write(“hi”); . as you can see console.log writes it to the console, whereas document.write writes it to the page. console.log is good for logging server statuses and loads.
9th Jul 2018, 4:20 PM
privrax.
privrax. - avatar
- 4
Nothing
23rd Jul 2017, 12:08 PM
LordGhostX
LordGhostX - avatar