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.


Liam Hayes
Liam Hayes
Full Stack JavaScript Techdegree Student 13,116 Points

Introducing JavaScript first code challenge

Check this out, I have these two files.

This web page:

<!DOCTYPE html>
    <title>Welcome to Treehouse Code Challenges!</title>
    <p>This is a webpage from inside a code challenge</p>
    <script src="js/app.js"></script>

And this .js file:

console.log('Hello, World!');

When I click Preview in the code challenge, the web page that is displayed says this:

This is a webpage from inside a code challenge

But it does NOT say "Hello, World!"

I was just wondering, How come the web page doesn't say "hello world" anywhere?

Thank you!!

Adam Beer
Adam Beer
11,313 Points

Start using it the Visual Studio Code. It's going to be difficult at first, but if you understand, it helps a lot.

2 Answers

Niclas Hilmersson
Niclas Hilmersson
8,296 Points

console.log doesn't print the message Hello World to the actual page. console.log prints a message in the console of the page. I Think he mentions that earlier in the video. Go rewatch and see if you can find how to access the debug console for the webpage and you should be able to find it printed there.

15,265 Points

prints to console (ctrl + shift + i (chrome) or ctrl + shift+ k (firefox));

console.log('Hello, World!');

To display on page use "document.write";

document.write ('Hello World');