0
can we write using document.write or just console.log?
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.
+ 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