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

Typo in the solution?

I noticed the question was stated as this:

Complete the code below to create a for loop that executes 10 times, writing the value of the variable i to the document each time:

_______(var i = 0; i <________ ; i++) { document.write(i); }

Is "i++" written correctly or did they mean to type "i+=1"?

3 Answers

i++ is the same as i = i + 1.

This makes i go up by one every time the for loop runs until the boolean condition is false.

This is simply shorthand and by no means a typo.

Best,

Jacob

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

Hi Joshua Harman. Thanks for pointing this out. Jacob Proffer is correct. i++ is the same as i += 1. However, I didn't demonstrate that in my course, so I can see how the question would be confusing. I've updated the question so that it now uses i += 1. Thanks!

Hey Dave, I'm not sure who else or where to ask this, but Is there an issue with the iTunes feeds?

Thanks for the info!!! SWEET! That's awesome!!