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

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,107 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.