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

JavaScript JavaScript Loops, Arrays and Objects Simplify Repetitive Tasks with Loops Review For Loops and Loop Exiting

The test is wrong on one of the questions. See the screenshot here: https://screencast.com/t/iCQeAodDg

No, it counts from 0, so it does go 11 rounds, but the last output is 10.

so: 0 1 2 3 4 5 6 7 8 9 10 // 11

you want: 0 1 2 3 4 5 6 7 8 9 // 10

1 Answer

for ( var i = 0; i < 10; i++) {
  console.log(i)
} ```
This will run the code 10 times. Bear in mind the counter starts at 0. It will run from zero to nine, which are 10 times.