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

HI, when I try to load the file I get an Failed to load resource: net::ERR_FILE_NOT_FOUND how do I proceed ?

<!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> 

     AND  myscript.js directory is same as the index.html directory 

myscript.js

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

2 Answers

Hey Paul, a couple things to check just so we can make sure that we don't have any of the common errors here. First, I noticed that the code you copied in is missing an opening <html> and an opening <head> tag. While this won't affect the error message you received, it is good for solidarity.

Second, let's double check to make sure that the file, myscript.js, is located right alongside the index.html in the file browser. I have sometimes put a JS file into a folder named "js" and then completely forgotten about it.

Third, let's see if "myscript.js" has a filename that matches what is given in the HTML document. Go to the actual source of the file in your file explorer and ensure the filename is exactly "myscript.js". It is a common mistake for all of us to mistype a filename and then wonder why we can't get anything done haha.

If this has helped you and solved the error, hitting that Best Answer button would be great! :) Thanks!

Gregory Serfaty
Gregory Serfaty
37,140 Points

Hi

Your script is load but like you put it in the beginning of you DOM your page is not ready when the script is load so put your script juste before the </body>

or in your javascript file put like this $(document).ready(function(){ console.log("Hello from my script"); )};