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!
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
Gal Parselany
Front End Web Development Techdegree Graduate 20,051 PointsI did it another way, is that ok? or I have some bug that I dont see yet :
for (i = 1; i < 11; i++) {
main.innerHTML += <div>${html}${i}</div>
;
}
1 Answer

Steven Parker
224,936 PointsYour code produces items numbered 1 to 10, where the video code creates 0 to 9. Otherwise, the result is identical.
The video code builds up the "html" string in the loop first and then outputs it one time, where this code is outputting each element one at a time.
Also, since you're not assigning anything to the "html" variable you can eliminate it entirely:
for (i = 1; i < 11; i++) { main.innerHTML += `<div>${i}</div>`; }
Gal Parselany
Front End Web Development Techdegree Graduate 20,051 PointsGal Parselany
Front End Web Development Techdegree Graduate 20,051 Pointsthanks again!