Javascript file is not working with HTML

I’d normally structure my projects something like this

using this to test before I start any development, that way I know everything is connected.

HTML:

<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Sample Project Folder Demo</title>
    <link rel="stylesheet" href="css/style.css">
  </head>
  <body>
    <h1>Sample Project Folder Demo</h1>
    <img src="images/sample.jpg">
    <script src="js/script.js" charset="utf-8"></script>
  </body>
</html>

CSS:

body {
  background-color: red;
}

JavaScript:

console.log('script.js says "I\'m here"');

which gives this

1 Like