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 Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Review while loops, do...while loops, and Loop Conditions

Finish the code in this do/while loop, so that the following lines are output to the console

I don't understand how to do this problem. I know where there DO and the WHILE words go, but I don't know what numbers go in the remaining two spaces. I have tried: 1, 2 and 1, 3 .

1 Answer

Steven Parker
Steven Parker
231,275 Points

One idea that might help is to think about (perhaps even write down) how you would write a "do...while" loop to produce the output shown. Then compare your program to the one with the blanks to determine what goes in each blank.

Hint: only one of the blanks stands for a number, the others represent keywords or variable names