DEV Community

stalin s
stalin s

Posted on

JavaScript linking your javascript file

JavaScript file ends with a .js. These files are then stored in a js Folder that's located at the same level of your HTML for easy indication.

attached folder structure below [for clear visualization]
Like this
Image description

Now let's get into main topic for our discussion.

   ** Linking your JavaScript file to your HTML file**
Enter fullscreen mode Exit fullscreen mode

For JavaScript files to work , we need to link them you HTML file - > This can be done by adding script tag at the bottom of the html document before closing the body tag or inside inside head section

<html>
<head>
<meta charset="utf-8" />
<title>Title website </title>
</head>
<body>
<!-- Please enter js script inside -->
<script src="js/index.js"></script>
</body>
</html>

In index.js file ,Let's enter alert('Javascript file linked').

If we try to open the index.html , the browser will display a pop that says "Javascirpt file linked".

Attaching image below.
Image description

Happy learning💗

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay