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

Jason Vines
Jason Vines
5,207 Points

JS Loops, Arrays & Objects 'for loop' Challenge Task 1 throwing an error on my code answer.

When I submit my answer for the challenge it displays the "Bummer..." message but when I copied the code and put it in my own editor and ran it through Chrome and the console it worked just fine.

script.js
for (var i = 4; i < 157; i += 1) {
  console.log(i + ' ');
}
SRIMUGAN J
SRIMUGAN J
Courses Plus Student 5,345 Points

Hi Jason,

just remove the empty string added in the console.log. It'll pass the challenge.

1 Answer

Ari Misha
Ari Misha
19,323 Points

Hiya Jason! You're very close and your code will everywhere else except for challenges coz you're exactly following the instructions. So yeah just remove that extra space you added to your local alias "i" in the "for" loop and you're good to go. (:

Jason Vines
Jason Vines
5,207 Points

Ah, I see what you are saying. Worked perfectly now. Thanks.