All TutorialsCoursesEvents & Contests

Sign in to Track Your Progress


Hello World Program in JavaScript

Introduction to JavaScript

Why Learn JavaScript?

Hello World Program in JavaScript


Sign in to Track Your Progress

Hello World Program in JavaScript

By Mukul Latiyan

Updated on : 14 Oct 2022

4 mins read

Published on : 14 Oct 2022

Requirements to Run JavaScript Code

While learning JavaScript, having a good understanding of HTML and CSS is definitely a plus point. It's because, with JavaScript, you will be working with web pages and browsers, so an understanding of HTML and CSS will help you manipulate and style web pages.

Besides that, you will also use an IDE (Integrated Development Environment). An IDE is a place where you will write your JavaScript code.

At the current time, Visual Studio Code is the most popular IDE for JavaScript, so try to get familiar with it as you will be using it a lot in the coming days.

Visit this guide, to download the IDE.

You can also use online IDEs as well, but make sure to run code on your machine to make the most out of this course.

Once the working environment is set up completely, we will write a simple hello world program.

Hello World in JavaScript

A Hello World Program in JavaScript prints the text Hello World to the console.

For this we will use a HTML file and inside the HTML file, we will add a script tag. We will then write our JavaScript code inside that tag.

<!DOCTYPE html>
<html lang="en">
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Hello World - JavaScript Example</title>
                console.log("Hello World");

Explanation - We created a simple HTML5 document. Just focus on the <script> tag inside the body.

There you can find console.log("Hello World"); which prints the output Hello World onto the terminal.

To see the output,
  • run this index.html file in your browser
  • open the developer tool
  • go to the console where you will see "Hello World"


You can see we have successfully completed the Hello World Program in JavaScript. From the next articles, we will use this exact format to write our JavaScript code.

Check Out Programs Offered By Masai

If you are currently studying in 1st, 2nd or pre-final year of college,

Connect with a growingcommunity of learners

Masai School

Get StartedJoin the Program