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.
A web console is available in all modern web browsers, and its primary purpose is debugging.
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.