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 trialAndrew Hubright
132 PointsI replicated the html code and followed all the steps but the console.log is not printing in chrome?
I can see the page headers and it is sans serif and appropriate size. I tried placing the script command in different areas of the the HTML, still no luck. Also tried running it using firefox and firebug.
4 Answers
Andrew Hubright
132 Pointsah, of course.. apologies.
Here it is:
console.log("Hello from myscript.js");
Andrew Hubright
132 Pointsand, here is the html: (the script is at the end, but I have tried it in the instructed position and a few others as well)
<!DOCTYPE html>
<html lang="en">
<head>
<title> Introduction to Programming</title>
<style>
html{
background: #7a7a7a;
font-family: helvetica;
}
</style>
</head>
<body>
<h1>Introduction to Programming</h1>
<h2>with Javascript</h2>
</body>
</html>
<script src="myscript.js"></script>
notf0und
11,940 PointsYour script tag needs to be inside the html tags. Put it before closing your body tag, and it will work.
Andrew Hubright
132 PointsIf you read my other comment below you will see I have already tried that. No dice
Jason Anello
Courses Plus Student 94,610 PointsHi Andrew,
Normally the script tag would be placed in either the <head>
section of the page or right before the closing </body>
tag.
If you have placed it there then it should be working.
Is your js and html file in the same folder?
All that this script does is log a string to the console. Are you looking in the console panel of your browsers developer tools?
It's not going to output anything to the page where you see the h1
and h2
.
notf0und
11,940 Pointsnotf0und
11,940 PointsPlease post all your javascript code with the markdown. It should go between 3 backtick characters on each end.
Here's a good post on doing it: https://teamtreehouse.com/forum/posting-code-to-the-forum