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 trial

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 seal-36
Karina Rogers
Front End Web Development Techdegree Graduate 15,909 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}`);
}