I'm learning JavaScript from codcadmey and on there course if i have to print something on the console I've to write console.log | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm learning JavaScript from codcadmey and on there course if i have to print something on the console I've to write console.log

and on other places have to write document.write why this difference please explain

11th Sep 2018, 6:03 AM
Bishnu Chourasiya
Bishnu Chourasiya - avatar
2 Answers
+ 3
It depends on you how to print the output. document.write - prints the output to the page. console.log - prints the output to the JS console.
11th Sep 2018, 7:18 AM
Email Not Activated
+ 2
document.write prints the text on the html file that is linked to the js. console.log prints the text on the javascript console.
11th Sep 2018, 6:16 AM
giannismach
giannismach - avatar