JavaScript Introduction

JavaScript is a most popular programming language of the word. JavaScript is a lightweight, interpreted and object oriented language. JavaScript is a high-level, object-oriented, multi-paradign client-side scripting language.

It is used for :

  • JavaScript is mainly used for enhancing the interaction of the webpage.
  • JavaScript can be used for mobile application and game development.
  • JavaScript can be used to modify HTML elements.
  • JavaScript can be used for native mobile applications.
  • JavaScript can be used for native desktop applications.
  • JavaScript can be used for Web applications on web servers.

JavaScript Program To Print Hello World

In this example, you will learn to print 'Hello World' in JavaScript in three diffrent way.

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

Using console.log()

console.log() is used to print in browser console. console.log() is used for basicaly checking JavaScript Error.

console.log('Hello World');

Using alert()

The alert() method displays an alert box with the specified message.

alert("Hello, World!");

Using document.write()

document.write() is used when you want to print the content to the HTML document.

document.write('Hello, World!');