Can someone help me link a .js with a .html

Hi I am learning javascript as school and successfully made a window.alert program, however I want to make my .html page less messy, so can I copy and paste the .js code in a .js file then link that .js file into my .html page?

Here are my pages, open them in google (I made them with thimble)

View my project:

https://thimbleprojects.org/ols500/437640

Many thanks ols :slight_smile:

Eheh :stuck_out_tongue:
If you want to include your js file do
<script> link to your js </script>
Hope it helps,
-LyR-

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
  <p2 class="title">Troll frog memes </p2>
  <p3 class="small">By Ollie Seaward, DO NOT COPY!</p3>
  
  
</body>  
  
  
  
<p id="demo"</p>
<script>java.js</script>
  
</html>

<script>java.js</script>
If your js file is named java and it is in the same folder of your html page it would work :slight_smile:

Oh right lol forgot to rename the .js file, it works perfectly, now my pages are all neat, thank you
Layer :slight_smile:

Oh man, i donโ€™t know what i was thinking when i wrote that :open_mouth:
The correct syntax is <script src = java.js></script>
If you solved your problem iโ€™m happy, but i just realized few minutes ago of what i wrote: Iโ€™m sorry if my mistake wasted your time :sob: