Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript Where Does JavaScript Go?

Elena Paraschiv
Elena Paraschiv
9,938 Points

Can someone that solved this problem guide me to solve it

the scripts.js file: alert("Hej,you're back for more?");

index. html file <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/main.css"> <title>JavaScript Basics</title> <script src="scripts.js"></script> <script> alert("Hej again, amigo"); </script>

</head> <body> <div class="container"> <h1>Where to place your JavaScript code.</h1> <script src="scripts.js"></script>

</body> </html>

The message from scripts.js file does not appear. I checked chrome's settings and JS is enabled.

2 Answers

Did you add the script to your index.html?

There are different ways to implement an external .js-file in an html. One option is the following:

<script src="path-to/your-script.js"></script>

Replace the path to your script with your info. Then this code snippet should be placed short before the closing body html tag.

In the tutorial it says to add it to the head section

Elena Paraschiv
Elena Paraschiv
9,938 Points

I fixed it. I reseted the options for Google Chrome and then it worked.