Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops Working with 'for' Loops Create a for Loop

Creating a for loop counting to 100

I'm slightly confused the code is saying it should count to 100 from 5, it looks like its doing that already.

script.js
for ( let counter = 5; counter <= 100; counter++ ) {
 console.log(`The number is ${counter}`); 
}

4 Answers

Hi Phil Smithies ,

Remove message just log variable counter.

Thanks

I did exactly that and I still get this message: "Bummer: The console should display 5 the first time through the loop and 100 the last time."

Thankyou!

Karina Rogers
seal-mask
.a{fill-rule:evenodd;}techdegree
Karina Rogers
Front End Web Development Techdegree Student 11,392 Points

UPDATE: I had to change 'console.log (${i});' to 'console.log (i);' and it worked.

I did the same thing and also got "Bummer: The console should display 5 the first time through the loop and 100 the last time." ... I tested it in my console and it seems to run fine? Not sure where to go from here...

for ( let i = 5; i <= 100; i++) {
 console.log (`${i}`);
}