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 Loops, Arrays and Objects Simplify Repetitive Tasks with Loops A Closer Look at Loop Conditions

As far as I can tell, I am writing the code exactly the way it is on the screen. Can anyone see the difference?

var upper = 10000; var randomNumber = getRandomNumber(upper); var guess; var attempts = 0;

function getRandomNumber(upper) { return Math.floor( Math.random() * upper ) + 1; }

while ( guess !== randomNumber ) { guess = getRandomNumber( upper ); attempts += 1; } document.write("<p>The random number was: " + randomNumber + "<p>"); doucment.write("<p>It took the computer "+ attempts + "attempts to get it right.</p>");

Jamie Reardon
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

Looks fine, but what exactly is the purpose/point of this question? Just trying to understand why you want to show this?

Your goal is not about manipulating every single line of code as the teachers do. Your goal is to find a solution, although, always seek to improve that solution in a better way.

Other than that, great job in "copycatting" it the same if that is all the post is about :)!

1 Answer

Had a typo