What is another way to show output in javascript aside from document.write() and alert()? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is another way to show output in javascript aside from document.write() and alert()?

1st Jan 2018, 1:11 AM
Ray
Ray - avatar
3 Answers
+ 6
The best way to output Javascript variables is use document.getElementById to update any elements with selected id. You could also use document.getElementsByClassName to update elements with selected class name.
1st Jan 2018, 1:16 AM
Calviղ
Calviղ - avatar
+ 1
Thanks !!
1st Jan 2018, 1:17 AM
Ray
Ray - avatar
0
Another way to show output is by writing: console.log().
1st Jan 2018, 1:15 AM
Ray
Ray - avatar