Close Menu

Get Started With JavaScript

Learn how to set up scripts on your website

Setting Up Your First Script

Before we dive deeper, let’s see how to run your very first JavaScript code!

<!DOCTYPE html>
<html>
<head>
<title>My First JS Script</title>
</head>
<body>
<h1>Welcome to JavaScript</h1>
<script>
alert('Hello, World!');
</script>
</body>
</html>

In the example above, the <script> tag contains JavaScript that displays a simple popup saying “Hello, World!” when you load the page. Easy, right?

Watch & Learn!

Learn about AI & ML on your favourite social media platforms

TikTok Logo

Internal & External Scripts

Internal Script: As seen above, you can place JavaScript directly in an HTML document inside the <script> tag.

External Script: You can also separate JavaScript into its own file, which helps keep your code clean and organized. Here’s how you would link an external JavaScript file:

<script src="myScript.js"></script>

Recent Guides

HowCodingWorks Logo