0

What is the difference between document.write() and console.log()?

Hi im trying my best to leanr programming.

23rd Aug 2021, 4:38 PM
Ultra_Playz
Ultra_Playz - avatar
3 odpowiedzi
+ 1
Ok thanks soo much!
25th Aug 2021, 3:51 PM
Ultra_Playz
Ultra_Playz - avatar
0
document.write() will show the output in webpage as a part of the page.. And if you use document.write() function it will first clear the index page or homepage... totally clear... and the show the output Example: <body> hello </body> output: hello window.onload = function () { document.write ("bye"); } output: bye Note: Hello removed And console.log() will show the output in a terminal.. I learned that coders use it to see, if everything is going fine.. I mean console.log (; This will show an error in the terminal because ')' missing.. And try to use more meaningful tags.. like JavaScript, sololearn, function etc.. I learned JavaScript a long time ago.. Now, I am learning programming.. So I may be wrong.. please correct me dear viewers🙂
23rd Aug 2021, 4:58 PM
Samael Morningstar