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 trialKatie Dunayczan
8,616 PointsI'm stuck and can't figure out why this code is wrong.
I'm just being told syntax error. I have tried looking up for loops on W3 and it looks like I'm writing it correctly but it's not working.
for (var i = 4; i<= 156; i +=1) {
console.log(i);
}
4 Answers
Katie Dunayczan
8,616 PointsThere must have been a bug or something. I just ran the same exact thing and this time it passed. I had made no changes.
Brad Mullett
76,854 PointsInstead of i += 1, try i++, like this
for (var i = 4; i<= 156; i ++) {
console.log(i);
}
Katie Dunayczan
8,616 PointsI tried i ++ and I'm getting the same response "There was an error with your code: SyntaxError: Parse error"
Falk Schwiefert
8,706 PointsThe code you have up there works for me in the challenge. But I had some issued before too. Try clearing the browser chache and submit your code again.
Andreas Remdt
7,721 PointsAndreas Remdt
7,721 PointsI tried this code out and it works fine. Are you sure there is no other code that causes the syntax error? The loop seems fine to me.