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 JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

JIAYING LU
JIAYING LU
1,545 Points

workspace preview

Hello there, I downloads workspaces for learning Java script. But when i clicked the preview, it only prints out a mistake page like :

Index of / scripts.js

Is it the browser or should I choose certain environment for Javascript when I open Workspace?

Thank you for letting me know. LU

2 Answers

Steven Parker
Steven Parker
231,248 Points

You can't use the preview directly on a JavaScript file.

You should also have an *index.html" file in your workspace that loads it. A workspace launched from inside one of the JavaScript courses would provide one for you, but a blank workspace would not have one.

Here's a minimal index.html that should get you going:

index.html
<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>JavaScript Workspace</title>
    </head>
    <body>
        <h1>JavaScript Workspace</h1>
        <script src="scripts.js"></script>
    </body>
</html>