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 The JavaScript Console

Jerry Wu
Jerry Wu
1,845 Points

In spite of the console.log command in my script.js file, nothing appears in JS console in Chrome. Why?

I have the following line of code written into my script.js file:

console.log("Program complete");

However, when I press CTRL + Shift + J to access JS console in my Google Chrome browser, the console box is completely empty--nothing is logged whatsoever. Why is this?

6 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

I agree with Kevin Korte. There is also the possibility that your browser cache is loading in an older version of your code as opposed to your newly altered code. Try viewing the same file in a private browsing tab or clearing your browser cache and then refresh the page. If this doesn't work, then we really will need to see your code to be able to assist you further :sparkles:

make sure you saved your work

Jerry Wu
Jerry Wu
1,845 Points

I did. At this point, I am attributing it to a browser glitch and perhaps I should have just refreshed the browser to see if that would fix the issue.

Kevin Korte
Kevin Korte
28,149 Points

Are you sure you have properly linked your JS file so that the browser will actually execute it? Would need to see more of your code to know that. From my experience, very very rarely can issues be attributed to a "browser glitch", and they are always the simplest of errors on our part

Can you share the whole file? Is it just the one line of code?

Dawson St. Julien
Dawson St. Julien
1,246 Points

Closing the preview tab in your browser and re-launching preview from workspaces seems to fix the issue. Must be a caching issue.