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

G. Silva
G. Silva
4,341 Points

My html page is not loading my java script file. error msg:Uncaught SyntaxError: Unexpected end of input

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

myfirstscript.js

console.log("Hello from myfirstscript.js");
console.log("Hello again!");
alert("Hello" + prompt("What is your name?"))

1 Answer

Joe Bruno
Joe Bruno
35,909 Points

You need a semicolon after your last statement.

 alert("Hello" + prompt("What is your name?"));

Also, on your script src statement, it should be:

 <script src="myfirstscript.js"></script>
G. Silva
G. Silva
4,341 Points

Thank you Joe, It solved the problems I was having.