What's the difference between document.write and console.log. I am confused | Sololearn: Learn to code for FREE!

0

What's the difference between document.write and console.log. I am confused

Javascript

2/25/2021 8:45:10 PM

Dayo Akinyemi

4 Answers

New Answer

+1

document.write or access to DOM elements (add nodes, update attributes/content)... but console.log is usefull for debugging ;)

0

document.write output to html document console.log output to browser console (developpers tools)

0

So which is needed in building a website?

0

-document.write: It's a function to show some output (including text and html elements) on the html page (It's clear everything on the page before doing this). -console.log: It's a function to show some output (only text) on the console's window. Run this example and you will understand the difference better: https://code.sololearn.com/WsUJl31RoADt/?ref=app