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 Tracking Multiple Items with Arrays Iterating through an Array

Ashkan Entezari
Ashkan Entezari
3,956 Points

My code is not passing the challenge! Need help

It seems to be a simple question, I can't find the problem in my code! Can anyone help me please?

for (var i=0; i<temperatures.lenght; i++) 
  console.log(temperatures[i]);

2 Answers

Scott Montgomery
Scott Montgomery
23,242 Points

ah, you switched up the last two letters in .length

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

I hate spelling errors like that. Sometimes I will stare at the code for hours trying to figure out what I did wrong... and it was something as simple as that. :)

Ashkan Entezari
Ashkan Entezari
3,956 Points

Ahhh.. thanks for finding this!

Scott Montgomery
Scott Montgomery
23,242 Points

Can you post the code you are trying?

the for loop should look something like this

for ( i=0; i < temperatures.length; i++ ){ console.log(temperatures[i]); }

Ashkan Entezari
Ashkan Entezari
3,956 Points

Sorry I thought my code will be automatically attached! I updated the post with my code, it's the same thing but it won't work!!