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

How would I console.log 2 Numbers to run 46 times or whatsoever the task is asking

script.js
for ( let counter = 5; counter <=5; counter ++ ) {
  console.log( counter <=46);
}

1 Answer

The challenge question linked is asking you to log each number from 5 to 100 using a loop (this will actually turn out to be 96 logs)

Your counter starts at 5, which is good! This means 5 will be the first number logged. However, putting counter <= 5 means that the loop will only run while that condition evaluates to true. Since your loop iterator increments by one, this loop will only run once. Your second condition should say run until counter <= 100 evaluates false.

Lastly, your log statement should simply log the counter variable

console.log( counter );