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 Introduction to Programming Basics Writing Your Program

I 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.

Please 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

4 Answers

ah, of course.. apologies.

Here it is:

console.log("Hello from myscript.js");

and, 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">
        <title> Introduction to Programming</title>
                background: #7a7a7a;
                font-family: helvetica;
    <h1>Introduction to Programming</h1>
    <h2>with Javascript</h2>
<script src="myscript.js"></script>

Your script tag needs to be inside the html tags. Put it before closing your body tag, and it will work.

If you read my other comment below you will see I have already tried that. No dice

Hi 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.