What is the correct javascript syntax to write hello world

what is the correct javascript syntax to write hello world
Table of Contents

If you are complete beginner to Javascript just started learning today want to write your first Javascript hello world program then I will show you how to write hello world program in javascript and what is the correct javascript syntac to write hello world.

This tutorial is completely for beginners who want to write their first javascript hello world program so let’s write javascript hello world program.

What is the correct javascript syntax to write hello world?

The correct javascript syntax to write hello world program is using the “document.write(‘Hello World’);”. This line of code will print Hello world on the web page.

				
					document.write('Hello World')
				
			

Output:

Javascript hello world program

Congratulations on writing your first javascript hello world program now let’s see how to write hello world program in javascript console.

If you want to test this code now without any software installation then you can check our HTML, CSS and Javascript compiler.

How to write hello world in javascript console?

You can also print hello world in your javascript console or terminal by using “console.log(‘Hello World’);” function this will print hello world in your terminal.

				
					console.log('Hello World')
				
			

Output:

				
					Hello World
				
			

You can test this code now by opening inspect tool in your chrome browser and go to the console tab and paste the code. It is mostly used for debugging in javascript.

Here are some more guides you can read:

I hope you found what you were looking for and found this guide helpful if you want more guides like this then subscribe to our Telegram channel – Join the Coderzway Telegram channel.

Thank you for reading, Have a nice day 🙂

Share This Post
Share on facebook
Share on twitter
Share on email
Share on whatsapp

Leave a Reply

Subscribe To Our Newsletter

Get updates and learn from the best

Latest Guides & Articles