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 trialSHAWNELL HARRISON
16,282 PointsPlease,I need help
let counter = 0;
while ( counter < 10 ) {
// code to run
counter += 1;
}
2 Answers
Rabin Gharti Magar
Front End Web Development Techdegree Graduate 20,928 PointsHey SHAWNELL HARRISON,
For this challenge, you need to log a value 26 times
by using a while loop
. You can place the increment count by one each time inside a code block
.
Here's the final code:
let count = 0;
while ( count<=25 ) {
count++;
console.log(count);
}
Hope this helps!
Jonathan Grieve
Treehouse Moderator 91,253 PointsHi Shawnell,
The loop will work, but there's a number of issues here.
The variable you want to track should be called count
.
You also want to run the loop 26 times not 10.
And you should log the value of the variable using console.log()
. Do this inside the while loop but above your counter variable where you're incrementing it. Good luck! :-)