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 trialAlex Lang
1,110 PointsI don't know how to get the right answer here...
var x = 1; Do { console.log('#' + x); x += 14; //Why is 14 wrong? What do I do here?// } while ( x <= 15 )
2 Answers
KRIS NIKOLAISEN
54,971 PointsAccording to the quiz here is what is displayed in the console
#1
#3
#5
#7
#9
#11
#13
#15
The initial value of x is 1 so that is logged the first time through. The next value logged is 3. 1 + 2 = 3. and so on.
If it were x += 1 then all numbers would be logged.
KRIS NIKOLAISEN
54,971 PointsYou are logging ever other number so each time you loop you would increment by 2.
Alex Lang
1,110 PointsHow do I know every other number i being logged? instead of x += 1;?
Alex Lang
1,110 PointsAlex Lang
1,110 PointsGotcha, Thanks for the help