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 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,368 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,368 Points

Great you got it running :D!