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 trialJosias 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
counter
variable. The value ofi
will be incremented each iteration, and that is what will need to be provided to theconsole.log()
method.Inside the
for
loop, a semi-colon is used to separate the parts, not a comma.The ending condition also needs to be modified. Using
i < 156
means that it will run wheni
is155
, but it won't run wheni
is 156 (which is a requirement of this challenge).