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 trialKim Dallas
11,461 Pointsi'm stuck again
i'm stuck with the loops. I don't know why
for (var i = 4; i= > 4; i = 156) {
console.log (i);
}
2 Answers
<noob />
17,062 Pointshi!, for loops work like that: u need to declare from where i start like u did, then u need to make a statement when the loop will stop which will happen in i<=156 and after that u need to increment the i in order to loop though each number. watch the videos again it will be more clear. if this answer helped u mark as best answer
Oenas Vaes
Front End Web Development Techdegree Graduate 17,319 PointsHey Kim,
You're almost there! Try to read and re-read your for loop, to really understand what it does. That's a trick I use when I'm stuck. So in this case;
Variable i equals 4; if i is smaller or equal to 156; add one to i until it equals 156. If you have any more questions just go ahead!
for ( var i = 4; i <= 156; i++ ) {
console.log(i);
}
Oenas
Kishan P
9,921 PointsKishan P
9,921 PointsHey, Kim
It's okay to get stuck and feel like u don't know anything. that's how i felt when i was working on that and TBH i was stuck for 2 weeks and after watching those videos too many times i finally figured it out...