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

At the end of the script (after alert()), add the code required to print 'End program' to browser's JavaScript console.

Can't figure this out. Can anyone help? https://teamtreehouse.com/library/javascript-basics/hello-javascript/write-javascript-statements

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
</head>
<body>
<script src ="app.js"> 

  console.log('Begin program');
  document.write("Welcome to JavaScript Basics");
  console.log('End program');

</script>
</body>
</html>
app.js
console.log("Begin program");

alert("I am programming!");

console.log("End program!")

5 Answers

John Maxwell
John Maxwell
9,249 Points

Try a semicolon at the end and remove the "!".

Also, I don't think you need code in your HTML, since you have the App.js linked in the script tag.

console.log("End program");

This is Challenge Task 4 of 4, and whenever I refresh this task, it makes me start over with Task 1 and onward again. I've restarted the entire Challenge from Task 1-4 about 6 times already. This is a problem with Treehouse that should be fixed. If we're stuck on one of the Tasks, it should let us restart that Task only, and not start over again from Task 1. https://teamtreehouse.com/library/javascript-basics/hello-javascript/write-javascript-statements

Can anyone help with this and point out what I got wrong? If you can post the correct code, that would be great.

I'm surprised no one asked about this Task yet, since I couldn't find it in the Community search.

John Maxwell
John Maxwell
9,249 Points

Preview the HTML and and refresh the page with DevTools open. It should explain what the JS issues are.

Thanks!