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 trialChikanma Ibeh
1,396 PointsWhy is this wrong?
Bummer: There was an error with your code: SyntaxError: Parse error
for (var = i; 4<=i<=156; 1=+ i) {
console.log (i)
}
1 Answer
Steven Parker
231,269 PointsTheres a few different syntax issues here:
-
var = i
the variable name must follow "var", and come before the equal-sign - the value being assigned to the var goes on the right of the equal-sign
-
4<=i<=156
you cannot test a single variable with two operators at the same time - but you can combine two individual tests with a logic operator
4<=i && i<=156
-
1=+ i
a "mirror image" of what you probably intendedi += 1