script src not working correctly!

So I’m having a problem with my code using Like most beginners on freecodecamp I began learning using

Here is my problem:

         script src="main.js">/script> (all my files are linked except javascript.. including my css, bootstrap, and external fonts)


as you can see here I’m linking to a .js file using the script tag, but the problem is that it’s not linking to my .js file…

however, if I write my script tags like so…

   alert('hello world')

it works…

I have looked up many sources online and have not figured out how to solve this small problem yet…
It seems many others are having this problem with

Any feedback would be greatly appreciated.

I don’t know if it is an artifact of the cutting and pasting, but your code is missing several brackets. For example:

script src="main.js">/script>

should be

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

Assuming your version is correct, and main.js is in the same directory, that should work. Another way to see what is happening is to check the dev tools network tab see if that file is loading. Without more information, I don’t see how we can help you. Try reducing the files and directory structure down to the bare minimum. If you are still having a problem, you can post what you have.

You mentioned codepen. Yes, it is a little frustrating when going from codepen to “real” coding, but it’s a big confusion over just a few things that doesn’t last too long. Also, codepen will output a directory structure of any project into a zip file that you can unzip and see exactly how that project would look in the “real world” with files and folders and everything. On the lower right, go to export -> export-to-zip.

If none of that works, I would checkout youtube. I’m sure there are simple videos of people stepping through building simple pages.

Let us know if we can help more.