+ 5
Silly but is console.log() and document.write() the same action?
So are they the same things? What is the difference.
5 Answers
+ 3
Console.log is some text that gets logged in the console/terminal of your ide if you use one.
Document.write gets displayed on the site.
+ 6
console.log ls prints a text in console, document.write Is prints text in website so they have difference
+ 6
console.log() will log your data in console, and here you will be able to debug it like you can see a object and it's property,
but document.write simply add that text in html section
+ 3
document.write("something") will print content inside as new document to webpage, also if you have any html code and you run this it will change document and overide to new value you entered, so because of that, document.write is not used too much. You can use this to render your page using js.
console.log("something") allow you to log anything you need to console, it is very good for debuging and tracking how your value change in your code
+ 2
console.log( ) also add a new line. If you wanna print in the same line, you may try process.stdout.write( )