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) Storing and Tracking Information with Variables The Variable Challenge

Mark Nichols
Mark Nichols
5,456 Points

Is my javascript code wrong or is workspaces not working?

For the madlib javascript challenge I start out by asking the user a question with the following javascript:

prompt('Enter an adjective');

I save the workspace, refresh the browser and no prompt appears. I check the javascript console and get this error message:

port-80-uxqa9r5tyy.treehouse-app.com/:11 GET http://port-80-uxqa9r5tyy.treehouse-app.com/story.js

Is there something I'm doing wrong on my end or is this a problem with the workspaces. This doesn't look like a typical javascript error. I'd love to hear from a treehouse rep on this issues. Thanks!

Mark Nichols
Mark Nichols
5,456 Points

Update:

This is a more descriptive error i get in the javascript console:

Failed to load resource: the server responded with a status of 404 (Not Found)

From my interpretation, even if my code is wrong, this seems like a workspace issue. I tried closing and reloading workspace, no luck.

5 Answers

Mark- have you already tried checking the JS console to see if you had an error? Also you could try refreshing the page. I am still learning JavaScript but those are two things that have helped me.

Mark Nichols
Mark Nichols
5,456 Points

Hi Kathleen. I checked the javascript console and I get the error message which I posted above. There is no indication of a syntax error, what I suspect is it's an issue with the workspace not connecting with my browser (chrome). I can stream video, email, and leave this comment, so I know the connection on my end is solid.

Dan Fris
Dan Fris
918 Points

How did you get it working? I'm experiencing the same problem.

Make sure you've created a JavaScript file called story.js and that it is in the same directory as the index.html file.

Don't put the JavaScript code between the script tags in index.html.

You shouldn't need to change the index.html file in the Workspace that Dave uses.

Iain Simmons and Dan Fris

I'm having the same problem. I deleted Dave's and rewrote it. Can you check to see if I have linked this correctly?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <link rel="stylesheet" href="css/main.css">
  <title>The Story Maker</title>
 </head>
<body>
  <div class="container">
  <h1>The Story Maker</h1>
  <script src="story.js"></script>
  </div>
</body>
</html>

I solved it!! Thanks!

Great! Can you share your solution with the community or describe what you did to fix it?

Sure Iain Simmons I checked that the src code was correct and made sure it was only listed once in the html.