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 Hello, JavaScript! Write JavaScript Statements

I don't understand this task

index.html
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>

  </body>
</html>
app.js
<!DocTYPE HTML>

1 Answer

For reference this is the challenge:

There are two files: index.html and app.js. To run the programming in app.js, you first need to load it into index.html. Add the required HTML to load the external JavaScript file into the web page. Make sure to add your code inside the <body> element.

RIght now both of your index.html and app.js files exist but there is no connection between the two. As they say in the challenge: in order for your app.js file to run it needs to be included into the index.html file, and specifically within the <body> element.

To add a js file we need to use the <script></script> tag with a src attribute. Since app.js is in the same folder as index.html it would look like this: <script src="app.js"></script>.

And the whole thing will look like this:

<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
    <!-- LOOK HERE! -->
    <script src="app.js"></script>
  </body>
</html>