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 trialJason Peay
16,515 Pointsquiz question
Finish this code to create a do...while loop.
var counter = 0
_____(console.log(counter); counter += 1; ) ____ (counter < 10 );
I have reviewed the video, several times, but I don't know how to complete this question.
3 Answers
jcorum
71,830 PointsHere you go:
var counter = 0;
do {
console.log(counter);
counter += 1;
} while (counter < 10);
Jason Peay
16,515 PointsThank you. The answer was simpler than I thought.
jcorum
71,830 PointsYes, I know the feeling. Been there!
Cindy Lea
Courses Plus Student 6,497 PointsHave you tried putting in Do in first blank & while in 2nd blank? The first condition happens only if true so its a Do & the 2nd blank is a while & will loop as long as counter < 10.