Confused | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Confused

Why many functions are there console.log() Or document.write() ...etc which is appropriate ?

3rd Jun 2019, 6:17 PM
Vineeth Margani
Vineeth Margani - avatar
3 Answers
+ 13
In my knowledge Console. log() is used to debugging By developers tools.. And document.write() method is just for testing purposes... Use document.getElementById("Id name");
3rd Jun 2019, 6:21 PM
Hëllo Wörld🔰
Hëllo Wörld🔰 - avatar
+ 4
None of them is really "appropriate", they have different functions, console.log will output in the console, so the document isn't messed up, you can see document.write even when you don't have access to the console
3rd Jun 2019, 6:20 PM
Airree
Airree - avatar
+ 2
Console.log() - press F12 in your browser you can see the console used for debugging Document.write() - used to test the website
4th Jun 2019, 1:51 PM
Tony Stark
Tony Stark - avatar