Hello World!

CodingTute

JavaScript

In this tutorial, you will get started javascript with Hello World! program. To run the JavaScript program, you will need to use a JavaScript runtime, such as a web browser or a command-line tool like Node.js. If you are using a web browser, you can include the JavaScript code in an HTML file inside the script tag and run it by opening the file in the browser. If you are using Node.js, you can save the code in a file with a .js extension and run it using the node command.

<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
    <script>
      console.log("Hello, World!");
    </script>
  </body>
</html>

In this example, the JavaScript code is included in the <script> tag in the body of the HTML document. When the HTML file is loaded in a web browser, the browser will execute the JavaScript code, which will print “Hello, World!” to the console.

You can also include the JavaScript code in an external file and reference it in the <script> tag using the src attribute:

<html>
  <head>
    <title>My Page</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
    <script src="hello.js"></script>
  </body>
</html>

In this case, the JavaScript code would be stored in a file called “hello.js” and would be loaded and executed when the HTML file is loaded in the browser.

You can find the complete JavaScript Tutorials here.

Follow us on Facebook, YouTube, Instagram, and Twitter for more exciting content and the latest updates.

Exit mobile version