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 JavaScript Basics (Retired) Introducing JavaScript The JavaScript Console

Matthew Stein
Matthew Stein
4,140 Points

Workspace appears to be loading the wrong scripts.js file (JavaScript Console step)

Hi. When I launched the workspace it contained the original scripts.js file with the two syntax errors. As per instructions I fixed the errors and saved the scripts.js file. But the Preview function still loads the original code with the errors. Here is the corrected text that appears on my scripts.js screen (after saving it): alert("hello there"); document.write("No it works!");

But when I open the console this is what I see: scripts.js: 1 Uncaught SyntaxError: missing ) after argument list

alert(hello there"); document.rite("No it works!"); (Somehow it is not seeing the added "w". No matter what I do the Workspace screen paints the word "write" in red, as if it is still misspelled "document.rite").

4 Answers

Matthew Stein
Matthew Stein
4,140 Points

Thanks for responding. Yes I saved the file before repreviewing. There seems to be a caching issue with the Workspace component -- probably because the normal navigation components are disabled (in the stand-alone window). After searching the community form and Chrome support I figured out how to resolve it. After saving the corrected file I need to click Preview (which opens the index.html with the original errors) and then refresh the browser's cache (on a Mac I held down Shift and clicked the Refresh arrow in the browser's toolbar). I'm not sure that most beginners taking this course would figure out what's going on.

I was having the exact same problem. Matthew Stein's solution (on a Mac I held down Shift and clicked the Refresh arrow in the browser's toolbar) worked for me.

Anna Meeks
Anna Meeks
8,643 Points

This totally worked for me too. I was going over and over the three lines of code and wondering what I did wrong. This was a quick and easy fix. :)

Joshua Bahr
Joshua Bahr
1,745 Points

Thanks for this! Super annoying issue, but all it needed was a refresh of the page...

Sounds like it's not refreshing. Did you save the file before previewing? Maybe close and reopen the workspace to force the preview to refresh?

I've had similar problems on Windows. I usually close the preview window and hit the preview icon again and it will refresh. Refreshing the original window never seems to work. I think refresh is "f5" on Windows, but closing and reopening has been more useful for me.

Confirmed. The browser (Chrome in my case) is caching the original files. Refreshing the page after it opens executes the newly-saved code.