Summary: This tutorial helps you get started with JavaScript by showing you how to embed JavaScript code into an HTML page to display the Hello World message.
Creating a JavaScript Hello World project
Step 1. Create a new project directory called helloworld to store the HTML and JavaScript files.
Step 2. Open the helloworld project directory in your favorite code editor. We’ll use the VS Code.
Step 3. Create a new HTML file namedindex.html inside the helloworld project directory with the following code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>JavaScript Hello, World!</title>
</head>
<body>
<script>
alert('Hello, World!');
</script>
</body>
</html>Code language: HTML, XML (xml)Step 4. Right-click the editor and select “Open with Live Server”. VS Code will start a web server and open the index.html in the default web browser: