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

Fuad Muhammad
Fuad Muhammad
4,273 Points

Where the 'guess' get the guess?

How the 'guess'/computer get the number to the guess? We can see on the text editor, the 'guess' is empty. And it must guess the number that will be out on the randomNumber function.

Is the computer get have the number itself on this device, or it get number from the random on the system, or javascript that make it happen.

Please explain me about what I asking. Don't explain too much. Thanks...

1 Answer

Umesh Ravji
Umesh Ravji
42,361 Points

Hi Fuad, without explaining too much, the guess variable is set in the while loop by obtaining a value from the getRandomNumber() function.

while ( guess !== randomNumber ) {
    guess = getRandomNumber( upper );
}
Fuad Muhammad
Fuad Muhammad
4,273 Points

Whataheck, It is not unthinkable by me before. Lol. Thank you so much, Umesh Ravji.