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

How to get the console to work with my code in the Workspace?

I can never get the console to come up when I do exercises in the Workspace.

Will someone please assist me?

4 Answers

Cameron Childres
Cameron Childres
11,818 Points

Hi Jason,

You can pull up a JavaScript console on any web page with your browser through the developer tools. Here's how I would access the console for a page I'm working on in workspaces in Chrome:

  • From the workspace click the "Preview Workspace" icon (eye symbol) in the top right to open the page
  • On the opened page go to the Chrome menu, select "More Tools", and then click "Developer Tools"
  • Select "Console" from the top bar of developer tools

You can get there much quicker with keyboard shortcuts as well. If using Chrome on Windows you can use CTRL+SHIFT+I to open up developer tools, or CTRL+SHIFT+J to go directly to the JavaScript console.

Thank you for your response Cameron,

Please allow me to further clarify...

I can access the JavaScript console... the problem is that I cannot get the console to come up when I write code in the Workspace. I am currently doing the JavaScript class. I am attempting to work along side the instructor via Workspace. However whenever I use the "console.log" command it never works.

I am passing all of the exams. And I think I know how to use the console.log command. Unfortunately I simply cant get it to work within the teamtreehouse workspace. Clearly I must be doing something incorrect. I just don't know what.

Any assistance you could provide would be greatly appreciated!!!!!!!

Unfortunately, I cannot practice any of the coding in the class which involves the "console.log" command because I cannot get it to function.

Cameron Childres
Cameron Childres
11,818 Points

I think I understand now.

Are you trying to run your JavaScript in the workspaces console? The one that starts with a prompt like:

treehouse:~/workspace$

You can't run JavaScript commands directly in this space -- this is a Linux based console that is expecting bash commands. It is possible to run JavaScript files in this console using node but I would recommend sticking to the browser's built in JavaScript console until node is introduced by the instructor. Running JavaScript in the command line through workspaces will be introduced in later lessons.

Most of the earlier JavaScript lessons here expect you to preview the web page and then open your browser's JavaScript console using the steps I wrote above. You'll write your code in the workspace but you won't see any console.log messages until you save the file, click preview, and open the console from the newly opened page. It's very important that you click the preview icon before opening up developer tools otherwise you'll be debugging the workspace page itself instead of the page that you're working on.

If I'm still missing the mark please give me some more information on exactly what you're doing, such as: a link to the lesson you're working on, what you're clicking, what you're typing, errors you're running to, and what the result is. Otherwise I can only take a stab in the dark here.

I hope that I'm able to get you on the right track! Don't hesitate to ask if you have any questions.

Is there any way that you and I can communicate real time...on the phone... or perhaps via a chat box.... I am having challenges navigating the team tree house site...again I am passing the challenges and the tests but I am having difficulty with some of the basic functions of this site.

I have been trying to respond appropriately to your last response for the past hour however I keep losing everything that i type whenever I try to retrieve more info from the actual lesson.

I do not understand most of what was written above. I am new to tech so many of the references and vocabulary used in your response are foreign to me (i.e. Linux, bash commands, developer tools).

This is the latest project I am working on: JavaScript Numbers - Random Number Challenge In this challenge the instructor says to open the Workspace. Also there is a tag at the top of the screen which says to open the workspace... Am I misunderstanding this?

Again, I greatly appreciate your patience and any assistance you can provide.

Cameron Childres
Cameron Childres
11,818 Points

No worries Jason, I'm happy to help. I'm a volunteer here at Treehouse and I'm not aware of a way us to work this out in real-time but I have the next best thing: a video!

Click here to see me opening the workspace from this lesson, adding a console.log() statement, and viewing it in the JavaScript console. I also show how you can type statements directly in to the console once you have it open.

About the confusing tech jargon in the other comment: don't worry, you'll get there. You could read that paragraph as "if you see this weird prompt in workspaces then you're in the wrong place, you'll start using that later".

Progress!!!!

Yes, you have made progress with me... I watched and followed your video... Using Safari it still didn't work....

However using Chrome it did work!!!! But I also received a weird error message...

I did a screen shot but I don't know how to post the screen shot here.

This was in the address bar:

NotSecure | http://port-80-ejebblgohh.treehouse-app.com/favicon.ico

This is the error message I received:

Failed to load resource: the server responded with a status of 404 (Not Found) /favicon.ico:1

This was the code I typed into the random.js file:

console.log("Hello Jason Yay!!!!");

Any additional assistance you could provide would be greatly appreciated.

Cameron Childres
Cameron Childres
11,818 Points

The "failed to load resource" error can be safely ignored. That comes from Treehouse trying to load a little logo for the tab that isn't included in your page. It doesn't relate to your code and won't have any impact on it, so when you see it just act like it isn't there.

Ignoring the favicon error, did your console message show up?


I'm not a Safari user so I can't be much help there, but I know it also has development tools and a JavaScript console available. Here's a guide I came across that you may find useful.

Yes, the console message did show up!!!!

Thank you for your assistance!!! It is greatly appreciated.

On another note, do you know if Team treehouse has some type of tutorial for new users? I believe that I also need to learn how to reach other students and instructors in my class efficiently.

Cameron Childres
Cameron Childres
11,818 Points

Great to hear :)

You may want to check out:

Full disclosure, I have not viewed these courses myself but it looks like they're designed to provide a quick intro to using Treehouse.

Past that I've noticed that a lot of things are introduced naturally as you progress through the courses here.

For reaching other students and instructors the community is your best bet and a really good resource. If you have questions when watching a video you can scroll down to the bottom of the page and look for the "get help" button in the bottom right. This will show you questions others have asked that relate to yours and will allow you post a question to the community specific to the lesson that you're on. Here's a page with a few useful links for getting assistance from the community. Remember when asking a question to include all the relevant details you can -- it's very helpful to post the code you've written, errors your running in to, or anything else that will help get to a specific answer.