Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Introduction to Programming Basics Writing Your Program

I put my program in the console and I cannot get it to run.

This is the program I put in

<!DOCTYPE html>
<html lang="en">
<head>
    <title> Introduction to Programming</title>
    <style>
        html {
            background:#FAFAFA;
            font-family: sans-serif;
        }
    </style>
    <script src="myscript.js"</script>
</head>
    <body>
      <h1> Introduction to Programming</h1>
      <h2> with Javascript</h2>
    </body>
</html>

I made an file for it (index.html) Then I created a javascript file (myscript.js ). console.log("Hello from myscript.js"); I made sure they are in the same folder and I placed the html in the console, refreshed the page and I got message from chrome saying:

Failed to load resource: the server responded with a status of 403 (Forbidden) https://plus.google.com/u/0/_/notifications/frame?sourceid=243&hl=en&origin…enderstart&id=I1_1412999607065&parent=https%3A%2F%2Fwww.google.com&pfname=

What did I do wrong?

Thanks for your time.

4 Answers

Hi Alisha,

You're missing an angle bracket on your opening script tag.

This <script src="myscript.js"</script> should be <script src="myscript.js"></script>

Are you saying that you put the html into the console or that you opened the html file in your browser?

The console is for running javascript.

You want to use either your browser's file menu to open your html file in your browser or you could drag your html file into a browser tab and view it that way.

You do want to have the console open though so you can see the log statement.

James Barnett
James Barnett
39,199 Points

You didn't correctly close your <script> tag.

I originally put the html file in console. I just closed the closed the script and I tried to view the html in the browser. It didn't work. It ended up opening a google search page.

What steps did you take to view the html in the browser?

Do you have a folder open which shows your html and js files? Are you able to drag your html file into your browser window?

I do have a folder open that shows both files. I dragged the file again. This time it worked. Thanks for your help.