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, Arrays and Objects Simplify Repetitive Tasks with Loops Create a for Loop

Blake Runyon
seal-mask
.a{fill-rule:evenodd;}techdegree
Blake Runyon
Full Stack JavaScript Techdegree Student 7,539 Points

Loops

This is getting old... I put this in a browser console and it works, yet it's telling me I don't have the right answer.

script.js
for ( let i = 4; i <= 156; i += 1 ) {
  console.log(i);
}

1 Answer

Steven Parker
Steven Parker
229,644 Points

Be careful about testing challenges externally, the code may run fine but not meet the objective.

But in this case, that is a correct solution. Try restarting your browser.

Blake Runyon
seal-mask
.a{fill-rule:evenodd;}techdegree
Blake Runyon
Full Stack JavaScript Techdegree Student 7,539 Points

Hey Steven, thanks for the warning :D

I did try restart many times :( idk why it won't work. 3rd challenge where I think I have it correct but it doesn't seem to work. Bummer.

Steven Parker
Steven Parker
229,644 Points

This is definitely correct. To be certain, I copied and pasted the code above directly into the challenge and it passed.

It might be worth a try to reboot the computer itself.