Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.