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.
Teacher Russell16,873 Points
Oh my, I was just being nostalgic and revisiting these exercises of long ago. This code runs here, but never end. No match. Originally I had done this from memory in my text editor using es6 syntax and had problems. For one, it said prompt was undefined. I came back here to test it on Treehouse, and something's still not right.
Steven Parker216,878 Points
Hi, I got your request message.
But the issue with the code is due to the handling of the guess:
guess = prompt('I am thinking of a number between 1 and 10. What is it?'); guess += 1;
So if the input is a string of digits between 1 and 10, the next line tacks on another "1" digit making it 11, 21, 31, ...etc up to 101. Since none of these will ever match a random number between 1 and 10, the loop never ends.