Hello World In JavaScript

Here is an example of ‘Hello World’ in Javascript.

console.log('Hello World');

In JavaScript, console.log() is a method that outputs data to the console. It’s commonly used for debugging and printing messages to the user.

So, in the “Hello, World!” example, we’re simply calling console.log() with the string “Hello, World!” as an argument. When the program runs, it outputs “Hello, World!” to the console.

Here are some variations of the “Hello, World!” program that you might encounter:

Example 1: Printing a variable

const message = "Hello, World!";

In this example, we store the message “Hello, World!” in a variable called message, and then pass that variable as an argument to console.log(). The output will be the same as the original program: “Hello, World!”.

Example 2: Using template literals

const name = "John";
console.log(`Hello, ${name}!`);

Here, we use a feature of JavaScript called template literals to include a variable in our output string. The `${name}` syntax is called a template literal placeholder, and it will be replaced with the value of the name variable when the code is executed. The output of this program would be “Hello, John!”.

Example 3: Using alert()

alert("Hello, World!");

The `alert()` method is another way to output data to the user in JavaScript. It displays a popup message with the specified text. In this example, when the program runs, a popup window will appear with the message “Hello, World!”.

I hope you loved the article on “Hello World In JavaScript”. I am preparing some more articles for future. I am looking forward to your feedback and questions.


  1. The next time I read a blog, I hope that it wont disappoint me just as much as this particular one. After all, I know it was my choice to read, but I truly thought you would probably have something interesting to say. All I hear is a bunch of crying about something you can fix if you werent too busy seeking attention.

  2. Nice post. I learn something totally new and challenging on sites I stumbleupon everyday. It will always be exciting to read content from other writers and practice a little something from other sites.

  3. Im very pleased to find this page. I wanted to thank you for ones time just for this wonderful read!! I definitely really liked every bit of it and i also have you book-marked to check out new things on your blog.

  4. Greetings! Very useful advice in this particular article! It is the little changes that produce the largest changes. Thanks for sharing!

  5. I wanted to thank you for this great read!! I certainly enjoyed every little bit of it. I’ve got you bookmarked to check out new stuff you post.

Leave a Reply

Your email address will not be published.