In this Javascript programming example we will learn create first Javascript program to print "Hello world". There are different ways to print Hello World in Javascript

  • alert()
  • console.log()
  • document.write()


Print Hello World using alert()

alert() is a method used in Javascript to display messages as alert boxes on the current window.


alert('Hello World');


This will print the Hello World inside alert box on the current window.


Print Hello World using console.log()

This Javascript function will write the messages on the console, which we will used mostly while debug the applications.

console.log('Hello World');



Print Hello World using document.write()

This document.write() method will used to print the web content on the window we will use this method.

document.write('Hello World');


we learned what are the Javascript print functions and how to use theme inside Javascript code. We will learn more about Javascript example in the coming articles.

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns