Writing “Hello, World!” in JavaScript
To print the message “Hello, World!” in JavaScript programming, you get two default options, where JavaScript programmers can apply console.log() function to print the output in the web browser console, or can also use alert() function to display it in a pop-up window as per the requirement.

Here are the both examples for JavaScript programmers.
The console.log() function in JavaScript programming can display any text message information using the web browser console. Here you can follow the below syntax to print the message in the console screen.
console.log(“Hello World, To The Javasript!”);
Printing message using alert() function in JavaScript program.
Here you can use the alert function to display the message in a pop-up window in JavaScript program.
alert(“Hello World, To The Javasript!”);
How to run the above JavaScript code.
Open the developer tool of your active web browser, and press Ctrl + Shift + I or Cmd + Option + I keys manually from the keyboard.
Now move to the console tab in the web browser.
Now paste in one of the above JavaScript program code snippets.
And press Enter key manually.
Here you should see the program output written by you displayed either in the console with console.log() or in a pop-up alert with alert() function.