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

Can't get a do while statement to run

the quiz wants me to make

var x = 1;
do {
    console.log('#' + x);
    x += ___
} while ( x <=15 )

to print #1 #3 #5 #7 #9 #11 #13 #15 I can't figure out what value is supposed to fill in the blank. I got the do and while, and that the console needs to write # and the value of x to the console, but every number i tried to enter for the x += value hasn't worked :(

2 Answers

you already set the value of x = 1, then x is now 1. and you want to print 1, 3, 5, 7, 9, 11, 13, 15.

1 + 2 = 3,

3 + 2 = 5,

as you can see its adding 2 everytime.

thanks so much! totally makes since