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 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