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) Making Decisions with Conditional Statements Improving the Random Number Guessing Game

fahad lashari
fahad lashari
7,693 Points

The Work space does not update the code. When I check the JavaScript console. It shows the old code! y u no update?!

The Work space does not update the code. When I check the JavaScript console. It shows the old code! By old code I mean the code which is already there from when I open the work space.

Even If I change everything and click run, It does not work! and when I check for errors using ctrl+shit+j. It shows that there is an error on line 15 which is long gone! and the console shows the old code. Why does the work space not run my newly typed code?!

fahad lashari
fahad lashari
7,693 Points

var correctGuess = false;

var RandomNum = Math.floor(Math.random()) * 6 + 1;

var guess = prompt('I am thinking of a number between 1 and 6. Can you guess which number?');

var RandomNumIsLarger = false;

if (parseInt(guess) === RandomNum){

correctGuess = true;

}

if ( correctGuess ) { alert('You got it right!'); }

else { alert('Incorrect'); }

Jesus Mendoza
Jesus Mendoza
23,289 Points

Are you saving the work space before clicking run?

2 Answers

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

Hi there! The code isn't being run in the workspace. It's being run from the browser. If it's not updating it's likely because your browser is loading in old cached data. Try clearing your browser cache and see if that helps! :sparkles:

fahad lashari
fahad lashari
7,693 Points

That was it! thank you!! thank you! :-D

fahad lashari
fahad lashari
7,693 Points

Yes I am saving the work before running it. Problem still persists