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

Help please

What am I missing?

script.js
var noom;
for ( noom = 4; noom <= 157; noom++) {
  console.log('noom' += 1);
};

2 Answers

Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,073 Points

You can declare the variable inside the for like this:

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

And for the log part you have to "log" the variable that is taking each number value, in this case the variable named "i".. Remember to use the less than instead of the less than or equal to if you are going to put the number 157.

I hope that helps a little bit.

Tobiasz Gala
seal-mask
.a{fill-rule:evenodd;}techdegree
Tobiasz Gala
Full Stack JavaScript Techdegree Student 23,529 Points

so first declare your variable inside loop it looks better

for ( var noom = 4; noom <= 157; noom++)

second since you are increasing noom variable everytime loop ends

noom++

you don't need to do it inside the loop.. just call it

console.log(noom);
for ( var noom = 4; noom <= 157; noom++) {
  console.log(noom);
};
Carlos Federico Puebla Larregle
Carlos Federico Puebla Larregle
21,073 Points

Remember to omit the "=" operator if you are going to "check" with the number 157 because the task is asking for you to log the number from 4 to 156. With noom <= 157 it would log the number 157 too, so be careful. Do it like this in that case:

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