0

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

6th Mar 2021, 3:38 AM
Duy Gia
Duy Gia - avatar
2 Réponses
+ 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