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 trialJerry Schrader
4,396 Pointscode not working
Workspace gives a blank page, and JSBin throws error. here is my code:
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('What is my number under 10'); guessCount += 1; if(parseInt(guess) === randomNumber) { correctGuess = true; } } while ( ! correctGuess );
document.write("You got it");
1 Answer
Jake Lundberg
13,965 PointsI copy and pasted the code you listed, and it seems to work fine on my end. Do you have additional code that may be interfering?
Jerry Schrader
4,396 Pointsno, that's it. I tried it in jsbin, and no good, just got an error (on top of the document.write can be a form of eval. error), and in workspaces, I get an empty page. I guess as long as it's right, I'll move on. Thanks!
Jacob Mishkin
23,118 PointsJacob Mishkin
23,118 Pointscan you format your code inside your questions so we can take a look at your problem better.
if you don't know how please see the Markdown Cheatsheet just above the post comment button.