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 am really confused on what this section is asking me to do please help.

index.html
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
  </head>
  <body>
    <script scr="Begin program"></script>
  </body>
</html>
app.js
console.log('Begin program');

2 Answers

Amy Denzer
Amy Denzer
9,899 Points

The instructions want you to add the required HTML to load the external JavaScript file into the web page. It's practice. In order for your HTML page to access your JavaScript file, you have to load it. The code you write will go into the body element using script tags.

In summary: We add a <script> tag inside the <body> element. The src attribute of the <script> tag specifies the path to your external JavaScript file (app.js). (Be sure to provide the correct path to app.js) When the browser encounters this <script> tag, it will load and execute the code from app.js

Here's an example:

<!DOCTYPE HTML> 
<html> 
<head> <meta charset="utf-8"> 
<title>JavaScript Basics</title> 
</head> 
<body> 
<!-- Include your external JavaScript file (app.js) using the script tag --> 
<script src="app.js"></script> 
</body> 
</html>```

So for some reason Its not going through at all despite my answer being correct. I've logged out of Treehouse to try to fix the problem but it wont let me go through. I have the script logged in properly via the index.html <script src=app.js></script> and in the app.js i have console.log("Begin Program"); alert('I am programming');

Someone please tell me what the heck I'm doing wrong. Theres no way to reveal the answer or skip this and i just want to continue this course :(