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 trialDuncan Murtagh
1,557 Points"Create a for loop that logs the numbers 4 to 156 to the console" Challenge - solution not being accepted
Hi, please help my solution to the Challenge "Create a for loop that logs the numbers 4 to 156 to the console. To log a value to the console use the console.log( ) method." works in the Console (it delivers what is asked, in my view) but I am getting this message "Bummer: You need to log out EVERY number from 4 to 156 to the console. Your loop calls the console.log() method 154 times."
let number = '';
for ( let number=4; number <=156; number+=1 ) {
console.log(number);
}
console.log("all finished");
2 Answers
Steven Parker
231,236 PointsLog only the numbers, the instructions didn't ask for a "finished" message.
Also, you don't need to create "number" before the loop. The one created inside the loop will "shadow" it anyway.
Duncan Murtagh
1,557 PointsThanks Steven, once again.
I removed the console.log("all finished"); and it worked. I really think Treehouse shouldn't judge it as a 'fail' if you leave a simple console.log line in.
Steven Parker
231,236 PointsI'd guess the checking mechanism just counts how many outputs are made without looking at their contents.