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 trialLogan Detering
1,953 PointsPlease help
Telling me syntax error, also looking for track that goes over the debugging process
var count = 0;
while (count < 26) {
document.write(){
count 1++;
}
}
4 Answers
Albert Czarnecki
12,287 Pointsvar count = 0; while (count != 26) { count++; document.write(count); }
Kallil Belmonte
35,561 PointsHi Logan, this should work:
var count = 0;
while (count < 26) {
document.write(count++);
}
Vance Rivera
18,322 PointsYou have the answer mostly correct. Only issue I see is the opening and closing brackets after document.write. Removing that will solve your issue. Cheers!
var count = 0;
while(count < 26){
document.write();
count++;
}
Alexander Davison
65,469 PointsA couple problems:
- Your condition for the while loop is (count < 26)... count would never be 26 because you said less than 26 which includes all the numbers less than 26 (not including 26). Change the operator to <= (less than or equal to)!
- The document.write function doesn't take a block... you should put the count variable inside the parentheses!
- Lastly, you can't say count 1++, you could either say count++ or count += 1.
With all that, your code should change into this:
var count = 0;
while (count <= 26) {
document.write(count);
count++;
}
Hope it helps! ~Alex