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 trialAbdullahi Abdinasir Ali
9,520 PointsHow do I called it 10times
Where am get wrong the question wat do I have do with documen.write method with loop
var counter = 1;
while (counter < 10 ) {
document.write("<p>Now in loop #" + counter + "</p>");
counter += 1;
}
1 Answer
tobiastrinkler
Full Stack JavaScript Techdegree Student 16,538 PointsHi Abdullahi, In your example your code only runs nine times. You can either use my code below or just set the counter variable to zero.
var counter = 1;
while (counter <= 10) {
document.write("<p>Now in loop #" + counter + "</p>");
counter += 1;
}
Abdullahi Abdinasir Ali
9,520 PointsAbdullahi Abdinasir Ali
9,520 PointsGreat very helpful thanks