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

Dan Warren
Dan Warren
9,125 Points

Bug on 1 Coding Challenge of 2nd part of JavaScript Loops course

I can't get the page to run my code after I type it. I click 'Check Work' and it does nothing. Can someone address this?

script.js
for ( i = 5; i <= 100; i++ ) {
  console.log( `The value for 'i' is ${i}` );
}

3 Answers

Yup, it just asks you to log the value in the console. So don't add any text, just the variable name. console.log(i);. That should do it.

Hey Dan,

There is no bug there. You haven't declared your 'i' in a variable.

//example of a for loop
for(let i = 0; i <10; i++){

}

Hope that helps!

Dan Warren
Dan Warren
9,125 Points

Thank you, I added what was missing and now it's giving me an error that my code needs to start with 5 and end with 100. I thought the "let i = 5; i <= 100;' part of my code addressed that but I guess not. Any thoughts?

Hey @Dan Warren,

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

This will solve your issue!