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 trialAbel Gechure
13,608 PointsSyntax error : Parse error
My code looks fine, i have tested it in the browser and it runs and performs the task well. I am trying to complete the challenge but every time i am pressing the button check work, it returns a bummer(error). Is this a bug that has nothing to do with my code or what am i missing?
var count = 0;
while (count < 27) {
document.write(`<p>We are now in loop ${count}</p>`);
count += 1;
}
2 Answers
seth aruby
10,111 PointsHey Abel, So a couple of things here. Apparently the challenge does not appreciate usage of template literals as it doesn't seem like it can be passed by using them. Secondly, you've almost got it except that your code will print to the document 27 times, not 26. The value of count is initialized at '0' and your condition is set to check until value of count variable is less than 27. One simple change will get you there, just set your condition to check for count<26;
Steven Parker
231,268 PointsI don't think this challenge is prepared to handle template strings. Try using a plain string for the output (it doesn't need to include the count, but you can use concatenation if you want).
But also check your condition, the loop should run 26 times (and remember the count starts at zero).
Abel Gechure
13,608 PointsThank you very much ! Let me use string concatenation and correct the condition.
Abel Gechure
13,608 PointsAbel Gechure
13,608 PointsHey Seth, thank you very much for the help, I will correct the condition and use string concatenation in place of template literals (which I prefer).