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

This code challenge does not recognize that my script is correct. It runs correctly in a browser.

for (var i = 4; i <= 456; i++) { console.log(i); }

script.js
for (var i = 4; i <= 456; i++) {
   console.log(i);
}

2 Answers

Steven Parker
Steven Parker
229,644 Points

The problem with testing in a browser is that the browser has no idea what the criteria are for passing.

The instructions asked for "the numbers 4 to 156", but this code is counting from 4 to 456 instead.

Thanks, Steven, I caught my own error earlier. The challenge window is more challenging for writing code as the error responses are sometimes not useful. I was assuming my code was broken, not that I had simply mis-typed 156 as 456. I have written extensively in procedural languages before and was thrown by this one goof I made in the code challenge.