Printing Hello World
All of the above methods do the same thing: displaying the output, but they all have a different way of showing it.
document.write()is used to print strings on the web browser.
console.log()is used mainly during debugging.
alert()is used to display text in the dialog box that pops up on the screen.
write text as an output on a web browser screen.
A web console is available in all modern web browsers, and its
primary purpose is debugging.
console.log() is a
alert() is a method that displays a text
message in a dialog box, and that message pops up with the OK
button on the screen.