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

edgar robledo
6,067 PointsFinish the code in this do/while loop, so that the following lines are output to the console:
i did not get the question can you please help. Finish the code in this do/while loop, so that the following lines are output to the console:

Steven Parker
241,809 PointsThe answer given by Justin above is for a different question, plus explicit answers without any explanation are strongly discouraged by Treehouse.
Update: ...and apparently subject to redaction!
5 Answers

Steven Parker
241,809 PointsThe question shows you a bit of code that is intended to produce the output shown. Your task is to fill in the 4 blanks to complete the code.
Hints:
- each blank should be filled in with a single word or number
- no symbols or punctuation are needed in any blanks
- the question itself indicates this code uses a "do/while loop", check first for those keywords

David Ryan
Courses Plus Student 14,981 PointsThis doesn't help man lol

Steven Parker
241,809 PointsIt apparently did the trick for edgar! But it looks like someone posted another spoiler here, perhaps you saw it before it was redacted by a moderator.

David Ryan
Courses Plus Student 14,981 PointsSorry man. Wasn't trying to make it seem offensive. That's why I put lol. I am saying maybe some pseudocode or something may be a better way to get peoples hamsters spinning

Steven Parker
241,809 PointsNo offense taken, and I do sometimes use pseudocode in hints. This question wasn't very specific so I was just guessing at a few things that might help. I still have to wonder about the downvotes, though.

David Ryan
Courses Plus Student 14,981 PointsHaha why don't you just downvote me?? It's just a rating!

Steven Parker
241,809 PointsYou can't vote on comments, only answers.

Belma Gaukrodger
17,826 PointsTry the following answer -
var x = 1;
do {
console.log('#' + x );
x += 2;
} while ( x <= 15)

Steven Parker
241,809 Points Explicit answers without any explanation are strongly discouraged by Treehouse (and may be subject to redaction by staff or moderators, as was done with Justin's spoiler above).

Bartosz Kowalczyk
4,103 PointsYour x is a number next to #, it looks like that "#x". In first run of the loop console will give you #1 because you start with var x = 1. A simple mathematical sequence has been used in the task (x + 2) therefore you need to x += 2; each time until it reaches 15.

Mansor Almossa
Full Stack JavaScript Techdegree Student 2,525 Pointsthank you, it works

Cristabel Nichols
1,645 PointsI 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 .

Steven Parker
241,809 PointsAnother way to approach this 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.

olivia zeitler
6,128 Pointsokay boomer Steven

Steven Parker
241,809 PointsIt's nice to know that answers from years ago are still being read, but I don't understand this comment. Can you explain?

Ashton Little
7,352 PointsI was doing this wrong, lol.... I was doing
i += 1;
Didn't read the console output (shakes head)
Justin Otero
4,959 PointsJustin Otero
4,959 Points[Moderator redacted]