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 trialKaWai Guo
2,788 Pointswhat's wrong with my code?
can someone tell me what's wrong with my code?
var consoleLog;
for ( var i = 4; i <= 157; i += 1 ) { console.log(consoleLog); }
it saids my console.log method is only looped 154 times and it needs to include every number between 4 and 156. The var i is set to 4, so i dont know what else to do.
var consoleLog;
for ( var i = 4; i <= 157; i += 1 ) {
console.log(consoleLog);
}
1 Answer
Adam Beer
11,314 PointsThe task didn't told you, that create a new variable, and inside the for loop, you logged out the empty variable.
Just put the console.log() yourThe 157 is too much, you need 156. And logged out the variable what you use inside the ** for () ** loop.