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 trialDana Seidakhmetova
10,956 Pointsbonus challenge question
Why in Bonus challenge ( whileLoops.js file) we are using i = Math.floor(Math.random () * 10) two times: initialize before loop and also after while condition? This is how I did: i = 0; while(i !== 8) { i = Math.floor(Math.random() * 10); text += i + ' '; } print(text);
1 Answer
Steven Parker
231,275 PointsThere's rarely only one way to program a solution.
Your solution is equally effective and a bit more compact — good job!
For next time, when posting code to the forum, use Markdown formatting to preserve the appearance.
Dana Seidakhmetova
10,956 PointsDana Seidakhmetova
10,956 Pointsthanks! Did not know about MarkDown, thanks for advise
Steven Parker
231,275 PointsSteven Parker
231,275 PointsDana Seidakhmetova — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!