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

bonus 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
Steven Parker
231,269 Points

There's rarely only one way to program a solution.

Your solution is equally effective and a bit more compact — good job! :+1:

For next time, when posting code to the forum, use Markdown formatting to preserve the appearance.

thanks! Did not know about MarkDown, thanks for advise

Steven Parker
Steven Parker
231,269 Points

Dana Seidakhmetova — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!