JavaScript Display Possibilities | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

JavaScript Display Possibilities

Good day! So, I read a section at https://www.w3schools.com/js/js_output.asp that talked about the various Javascript Display Possibilities. Yet, Im still a little bit confuzzled. Can someone please maybe elaborate a little bit more on the differences between innerHTML, document.write(), window.alert(), and console.log()? Thanks!

4th Jun 2019, 8:39 PM
Dezy R Nezzy
Dezy R Nezzy - avatar
1 Answer
+ 1
innerHTML is basically enabling you to manipulate anything in a html tag, reading and improving/replacing anything on the website. document.write() is pretty self explanatory. It writes html expressions or javascript code to the document. window.alert() is a message box to convey important info that the viewer may otherwise miss. It is a textbox with an ok button. The console.log() is a function in which is used to print any kind of variables defined before in it or to just print any message that needs to be displayed to the user. I hope this helps!
4th Jun 2019, 9:30 PM
River
River - avatar