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?

Judah Ritterman
Judah Ritterman
620 Points

Why doesn't 'Preview The Workspace' respond to my code/work properly?

'Preview the workspace' icon (eye ball) is not reflecting my coding changes (not functioning as a terminal or output).

My code is working fine in JS Bin.

Wondering if there is something I am missing here.

Again, same code copied and pasted between JS Bin and 'workspace' (eye ball icon) and no result here but code is running fine as output on JS Bin.

Thanks!!!

11 Answers

Kristopher Van Sant
PLUS
Kristopher Van Sant
Courses Plus Student 18,830 Points

This might sound silly, but have you tried saving your workspace and then refreshing the browser?

Judah Ritterman
Judah Ritterman
620 Points

Will give that a try. Went ahead and moved onto the next section (which clears the workspace) since my code passed in JS Bin.

And I certainly saved in the JS and HTML files (after completing the code there), which I am assuming are the 'workspace'.

So, refreshing the browser...will give that a try next time.

Perhaps it is just the complexity of teaching code within a browser...like the bugs that happen on code academy with code passing or not.

Thanks for the quick reply!!!

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Ok great! When using Treehouse's workspace in order to see any changes you've made you have to refresh the browser each time after saving your workspace. The changes do not appear automatically. Hopefully that will fix the issue you're facing, if not let us know! :) and no problem! Happy to help. And welcome to Treehouse!

Judah Ritterman
Judah Ritterman
620 Points

great. that solves it. only regret is that I didn't join tree house earlier. I asked high and low (no pun intended with tree house) for the last 6 months and only yesterday got a definitive or convincing answer perhaps that tree house was the way to go.

this is exactly the platform I have been looking for.

I start a programming bootcamp in 2 months so at least I have time to train here but I am actually convinced that tree house could get me at least 75% of the way towards a junior developer job (if not 90% of the way).

thanks.

Judah Ritterman
Judah Ritterman
620 Points

Great. Will do. Again, Tree House is by far the best online tutorial resource I have encountered in 6 months.

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Awesome! Yes Treehouse really is a great tool for learning to Code and the community in the forum is pretty great too. Personal favorites online tutorial resources are Treehouse and Codecademy. I did courses through both before entering a Bootcamp and it helped tremendously. And I still use both to keep up to date, keep things fresh in mind, and to continue to learn new things. There's a lot I learned in the bootcamp I went through that you can't learn from online tutorials, so I think it's great you're taking that route. Wishing you the best on your journey to coding!

Judah Ritterman
Judah Ritterman
620 Points

Oh, cool. That is nice to hear. Yeah, the bootcamp starts in 2 months and is 6 months long. So 2 months of Tree House should be a good start (on top of the 6 months of painful online learning I have been doing).

I like code academy too and am grateful for the basic foundation they have given me.

Additionally, I am glad to have taken a next step by joining Tree House. I feel like the educational platform is exactly what I have been looking for and provides you everything one can hope (short of an 'immersive learning environment' like a bootcamp).

So now you work for Tree House?

Pretty cool...

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Very cool! Well don't burn yourself out too much! Have fun with what you're learning and don't forget to take time for yourself,everything will stick much better if you do.

I'm a moderator here in the forums, it's actually a volunteer position so I don't work for Treehouse. You'll see a bunch of us MODs around. We're here to help and support the Treehouse community. :)

Judah Ritterman
Judah Ritterman
620 Points

Cool. Yeah, I know. Burnout is no good. Trying to get my brain working this morning with a little water and snacks as I work through a Ruby Histogram/word counter. It takes new sentences, splits them up, puts them into word arrays and then iterates over them, counting the words and storing the words and the frequency of word occurrence in a frequency hash. then iterate over that frequency hash to print out each word and its frequency.

Am on the JS track in Tree House though...

Time for a little break...I agree with you on that. Thanks for the reminder. Thanks for the help.

Judah Ritterman
Judah Ritterman
620 Points

Hey there, still not having too much luck with the preview window.

Here is my code.

Can't figure out the issue here.

var randomNumber = getRandomNumber(10); var guess; var guessCount = 0; var correctGuess = false;

function getRandomNumber( upper ) { var num = Math.floor(Math.random() * upper) + 1; return num;

}

do { guess = prompt("guess number between 1 to 10"); guessCount += 1; if (parseInt(guess) === randomNumber) { correctGuess = true;
} } while( ! correctGuess); console.log("winning guess is: " + randomNumber + "number of guesses is: " + guessCount);

Kristopher Van Sant
PLUS
Kristopher Van Sant
Courses Plus Student 18,830 Points

Are you on the 'do ... while' Loops video? I tried out your code and everything works for me. The only thing I would think is the issue is that your program logs the message to the console which means it won't show up on the page like it does with document.write. Instead, in order to see the message you need to open up the browser console. You can do this by right clicking in the browser window and selecting inspect or inspect element depending on what browser you are using.

Judah Ritterman
Judah Ritterman
620 Points

Hey Kristopher,

More issues with the Workspace browser. It just doesn't want to load for the last 2 hours. Late night web construction going on?

Had to revert to JS Bin. Hoping things are up and running by the morning. Best.

Kristopher Van Sant
Kristopher Van Sant
Courses Plus Student 18,830 Points

Hmmm, I don't think there was any Treehouse site construction going on, normally if there's something happening on the site that will affect the students they'll post it on Twitter.

What browser are you using to preview your workspace? Preferably you should use Chrome or Firefox if you can. If it's having loading issues you might want to try completely closing it out and and reopening the browser and Treehouse again.

If you're still having trouble you might want to contact Treehouse support

https://teamtreehouse.com/support

help@teamtreehouse.com

Sorry you're having issues with this!

Judah Ritterman
Judah Ritterman
620 Points

hey Kristopher,

sent this to the support team.

simple code below that is correct and runs in JS Bin.

however, a good example of the issues I am having with the Workspace.

it rarely displays properly for chrome or even safari.

including with restarts and refreshing.

also, the code does not show up in the 'JS Developer Tools Console' (command, option, J).

any ideas???

var playList = [ ]; playList.push('I Did It My Way'); playList.push('Respect', 'Imagine'); playList.unshift('Born To Run'); document.write(playList);

Kristopher Van Sant
PLUS
Kristopher Van Sant
Courses Plus Student 18,830 Points

Oh good, glad you sent a message to support.

Your code typically does not show up the in the console unless you have console.log in your program. And then the only things that might show up is whatever you put inside your console.log.

What do you mean when you say it does not display properly? Does this mean some of it displays or none displays or it looks different then what the teacher's results look like?

As per the code you provided. Your results will look different then what the teacher gets in the video because you have...

document.write(playList);

instead of...

printList(playList);

The latter will display the playlist as actual numbered list, whereas what you have just writes the playlist array to the page so it will look completely different. What made you decide to use document.write instead of printList? Also for this example did you add the js sources to your index.html?

</div>
<script src="js/helpers.js"></script>
<script src="js/playlist.js"></script>
</body>

In the mean time, if you face any more challenges go ahead and start a new discussion in the forum for each different issue you face. And be sure to include a snapshot of your workspace when you do. This way other students and mods will see the new issues and be able to jump in and help too and offer another set of eyes. When something works in JS Bin and not workspaces maybe provide a link to both the JS Bin and the snapshot of the workspace.