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 Basics (Retired) Working With Numbers The Mad Libs Challenge Revisited

Rebecca Palumbo
Rebecca Palumbo
5,506 Points

Used a for loop and array

Just thought I'd post what I did if anyone wanted to see how to do it with a for loop and an array.

Leaders or pros - let me know if there's a better way to do this or if there is anything that is not a best practice. Thanks!

https://w.trhou.se/6m1996wtnm

3 Answers

Rebecca Palumbo
Rebecca Palumbo
5,506 Points

Because we were supposed to let the user know how many questions were left and I used the variable in the for loop to let the user know, which was decreasing.

Piotr Manczak
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Piotr Manczak
Front End Web Development Techdegree Graduate 29,324 Points

I would do it using increasing q but your way is quite interesting. As long as it works it's cool. Very refreshing approach. I have to remember that solution, it may be very useful in the future.