can we write using document.write or just console.log? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

can we write using document.write or just console.log?

6th Mar 2021, 3:38 AM
Duy Gia
Duy Gia - avatar
2 Antworten
+ 2
It depends on the purpose, document.write changes text in the webpage while console.log only appears in the console and generally is not visible to the user and mostly only used for debugging.
6th Mar 2021, 3:42 AM
EthanE230
EthanE230 - avatar
+ 1
console.log("") outputs whatever is passed as the parameter. e.g. console.log("hello world") will output "hello world" to your console document.write("") adds whatever you want to html. e.g. document.write("<p>paragraph</p>") will add a new paragraph to a document
6th Mar 2021, 3:59 AM
Adewale IyanuOluwa
Adewale IyanuOluwa - avatar