what is the correct javascript syntax to write hello world?

Today, We want to share with you what is the correct javascript syntax to write hello world.In this post we will show you how do you write “hello world” in an alert box?, hear for A “Hello, World!” is a simple program that prints Hello, World! on the screen. we will give you demo and example for implement.In this post, we will learn about Hello, world! with an example.

which is the correct way to write hello world in javascript

There are the 3 Ways to Print “hello world” Example with basic Fundamental a new programming language to beginners.

  • 1. Using console.log()
  • 2. Using alert()
  • 3. Using document.write()

What is the correct JavaScript syntax to write “Hello World”?

  1. document.write(“Hello World”);
  2. echo “Hello World”;
  3. response.write(“Hello World”);
  4. (“Hello World”);
  5. All Above


document.write(“Hello World”) is the correct syntax to write any thing inside Javascript Function.

Read Also:  VueJS Accessing index using v-for loop

Basically document.write is same as Console.Write in Windows or Response. Write in online Web Application in PHP code.


document.write() is a JavaScript simple command that literally writes out whatever you place between the opening and closing parentheses.

JavaScript Program To Print Hello World

Example 1: Using console.log()

// the hello world program
console.log('Hello World');

Example 2: Using alert()

// the hello world program
alert("Hello, World!");

Example 3: Using document.write()

// the hello world program
document.write('Hello, World!');

I hope you get an idea about inside which html element do we put the javascript?.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  How to Create CAPTCHA image verification using PHP and jQuery

About Pakainfo

I am Jaydeep Gondaliya, a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by Pakainfo →

Leave a Reply

Your email address will not be published. Required fields are marked *