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 trialLiam Hayes
Full Stack JavaScript Techdegree Student 13,116 PointsIntroducing JavaScript first code challenge
Check this out, I have these two files.
This web page:
<!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>
And this .js file:
console.log('Hello, World!');
When I click Preview in the code challenge, the web page that is displayed says this:
Greetings!
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!!
2 Answers
Niclas Hilmersson
8,296 Pointsconsole.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.
codekudos
15,271 Pointsprints 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');
Adam Beer
11,314 PointsAdam Beer
11,314 PointsStart using it the Visual Studio Code. It's going to be difficult at first, but if you understand, it helps a lot.