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

Carol Holmes
Carol Holmes
1,626 Points

Should I use && in the answer? If not, why? And am I close?

How do I represent limits? I tried .... count >=4; count<=156; but it wouldn't run? The && was another way I tried.

script.js
for(var count = 4; count >= 4 && <= 156; count += 1 ){
  console.log(count);
}
Carol Holmes
Carol Holmes
1,626 Points

for(var count = 0; count >= 4; count <= 156; count +=1;){ console.log(count); }

2 Answers

Hi Carol,

You're code is really close to working. Each time you do a comparison, there needs to be a variable (or literal value) on the left and a variable (or literal value) with which to compare on the right.

// change this
for(var count = 4; count >= 4 && <= 156; count += 1 )

// to this
for(var count = 4; count >= 4 && count <= 156; count += 1 )

Cheers