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 trialNayoon kim
3,098 PointsCan you tell me an answer to this simple 'for loop' question
I just don't get what is wrong, maybe I should put console.log(i); inside of the {}
for (var i = 1; 3<i<157; i++1) {
}
console.log(i);
2 Answers
Justin Cantley
18,068 PointsYes, you do want to move the
console.log(i);
inside of the braces. Also when incrementing the variable 'i' you don't want to write
i++1
The correct syntax can be 1 of the following:
i = i + 1;
i += 1;
i++;
Also instead of writing
3 < i < 157;
just start your variable i at 3 like so:
(var i = 3; i < 157; i++;)
Hope this helps!
nfs
35,526 Pointsthis one's a duplicate question. I urge you to delete this one.
Thank you, Nafis Faisal
Nayoon kim
3,098 PointsNayoon kim
3,098 Pointsah I see, thank you so much !