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

Next, in the app.js file, add the code required to print "Begin program" to the browser's JavaScript console.

What is the answer to this ?

index.html

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

app.js

7 Answers

On app.js

console.log("Begin program");

alert("I am programming!");

console.log("End program");

Steven Parker
Steven Parker
231,153 Points

That looks OK, didn't it work?

Steven Parker
Steven Parker
231,153 Points

You need to add a bit of code in the app.js file to do the task asked for. Try reviewing the videos with this objective in mind, I'd bet they contain an example of the same thing being done.

its not in the videos can u show me how to do it ?

Steven Parker
Steven Parker
231,153 Points

Line 13 of the code shown in the JavaScript Challenge Solution video is an example of printing a message to the console.

i know what to write in it just not where to put it in the javascript challenge solution

Steven Parker
Steven Parker
231,153 Points

The challenge should have an HTML file and a JavaScript file on different tabs. Select the "app.js" tab to get to where the Javascript code should go.

it didnt work i wrote this

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

do u have any suggestions ?

Steven Parker
Steven Parker
231,153 Points

Script code can either go between tags or in a separate file. This particular challenge is apparently using the 2nd approach (I updated my previous comments accordingly).

One thing to watch for is the "src" attribute, which is used to load in a separate file (and would not be used when the code is between the tags).

it works now. thank you

Steven Parker
Steven Parker
231,153 Points

michael radvany — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!

answer console.log("Begin program");