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

Tom McVay
seal-mask
.a{fill-rule:evenodd;}techdegree
Tom McVay
Full Stack JavaScript Techdegree Student 12,192 Points

why is this not acceptable as a for loop logging numbers 4-156 in the console in JS basics

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

Carl Evison
Carl Evison
2,656 Points

What do you mean by not acceptable? the code is perfectly valid.

Tom McVay
seal-mask
.a{fill-rule:evenodd;}techdegree
Tom McVay
Full Stack JavaScript Techdegree Student 12,192 Points

Am not using work spaces. Is just one of those challenge tasks on Javascript loops, arrays etc. Is it possible its a bug in the page? I appreciate your replies, thank you.

2 Answers

Some of the challenges won't accept let. Try var instead.

Carl Evison
Carl Evison
2,656 Points

Are you pasting this code directly into the console?

If you are using workspaces run node filename.js from the console replacing filename.js with the filename you saved it as.