9 AnswersNew Answer
Priyanshu Sharma hello,if you want to know in detail then you can visit this sites Document.write method https://www.w3schools.com/jsref/met_doc_write.asp Console.log method https://www.w3schools.com/jsref/met_console_log.asp
Priyanshu Sharma Good answer! but try to use try google for this common types of questions... Many websites and Youtube Tutorial available you can know in detail from there.
document.write will override everything in the screen to print the value(s) you passed to it. console.log will display values in the js console (note that in a real browser you actually have to open the console in "inspect element"). So the console is not something that you will show to the users... It depends on what your program will do.
ᕙ(＠°▽°＠)ᕗ Ok Thank you... I got it.
document.write() gives new learner a feel of how JS affects the DOM of the page. As a developer however I advise to use the methods of console. Not only log() exists but many others and each has it's own helpful function
Царь СОБАКА - Догго I So if we use document.write then the existing html output will be over written by the document.write... Is that what you say
And if we use console.log then where we get the output as it will be displayed in the console... I didn't get it please explain...