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 Introducing JavaScript Let's Make a Game Introducing Code Challenges

In the first code challenge I just noticed the html output of the task. What about console.log('Hello, World!'); code?

What the console.log('Hello, World!'); code in the app.js script is used for? I coundn't see any output from this code snip.

index.html
<!DOCTYPE html>
<html>
  <head>
    <title>Welcome to Treehouse Code Challenges!</title>
  </head>
  <body>
    <h1>Greetings!</h1>
    <p>This is a webpage from inside a code challenge</p>
    <script src="js/app.js"></script>
  </body>
</html>
app.js
console.log('Hello, World!');

2 Answers

It writes 'Hello world' in the console. To view this right click the page and press inspect and then hit console on the top navigation bar. It should be printed in there.

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hi there,

That line of code will log "Hello, World!" to the console. It will not be seen on the site, but if you open the Developer Tools in the browser, inside the console you will see Hello, World!.

Hope that helps. :) :dizzy: