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 Loops, Arrays and Objects Simplify Repetitive Tasks with Loops What are Loops?

Josh Lipton
Josh Lipton
13,255 Points

What is wrong with naming the .js file script.js?

I got thrown for a loop (newb pun intended) because I downloaded the project files video02 to work on this with. I couldn't get the random number to work until I changed the .js file from script.js to scripts.js. I was curious why this was and also wanted to point it out in case others are having the same issue.

2 Answers

Julian Aramburu
Julian Aramburu
11,367 Points

Hi Josh! Maybe it was because your script tag in your index file was targeting "scripts.js" instead of "script.js".

Josh Lipton
Josh Lipton
13,255 Points

So, I figured out the issue.

In my webhostingforstudents.com hosting, the default caching is static cache enabled.

I went to cPanel > Advanced > SuperCacher > Level 1 Static Cache, and turned off the manage super cacher.

I think what was happening was that my .js file changes weren't getting pushed to the browser. My original script.js file just coincidentally finally pushed up (delayed by 20 minute or so) when I changed script.js to scripts.js.

This may all be very newb level stuff, but hey isn't this the place for newbs to break through on these issues?

Julian Aramburu
Julian Aramburu
11,367 Points

Great you got it running :D!