Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!!