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!

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


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,314 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,267 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');