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
Josias Kabore
Full Stack JavaScript Techdegree Student 2,652 Pointscant figure out what's wrong with this for loop task
for loop code challenge
var counter="";
for(var i=4,i<156,i+=1){console.log(counter);
}
2 Answers
Umesh Ravji
42,386 PointsHi Josias, you have a few minor problems that you need to fix :)
You have no need for the
countervariable. The value ofiwill be incremented each iteration, and that is what will need to be provided to theconsole.log()method.Inside the
forloop, a semi-colon is used to separate the parts, not a comma.The ending condition also needs to be modified. Using
i < 156means that it will run wheniis155, but it won't run wheniis 156 (which is a requirement of this challenge).
Josias Kabore
Full Stack JavaScript Techdegree Student 2,652 PointsThanks