0

What is the main difference between console.log and document.write

I have been seeing people using console.log and sololearn is telling me that it is document.write. Can JavaScript gurus explain the difference.

24th Aug 2017, 5:45 PM
Adebanjo Adesuyi
4 Answers
+ 9
console.log outputs to console (you can see it in any browser by inspecting the page and opening the console tab) document.write will write on the page itself console.log is used mainly for debugging document.write shouldn't be used at any case to open console on Chrome browser simply open a webpage, right click somewhere in the page and click Inspect Page (or Ctrl + Shift + i) and click on the Console tab (between Elements and Sources)
24th Aug 2017, 5:49 PM
Burey
Burey - avatar
+ 9
console.log is handy to help you debug when you create something if you want to display something you will most likely use HTML elements and JS to manipulate them (to make it dynamic) (ain't gonna confuse you with other libraries and frameworks, as a beginner stick to HTML and JavaScript) i suggest you look into the HTML and JavaScript courses sololearn have to offer and once you finish those lookninto CSS if you want to learn how to design and style the page/s
24th Aug 2017, 5:59 PM
Burey
Burey - avatar
0
which one is more appropriate for building website, console.log or document.write.
24th Aug 2017, 5:50 PM
Adebanjo Adesuyi
0
Thanks Burey
25th Aug 2017, 12:11 PM
Adebanjo Adesuyi