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 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">
    <title> Introduction to Programming</title>
        html {
            font-family: sans-serif;
    <script src="myscript.js"</script>
      <h1> Introduction to Programming</h1>
      <h2> with Javascript</h2>

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.