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

bummer

what is wrong??

script.js
var temperatures = [100,90,99,80,70,65,30,10];

for (var i=100; i<temperatures.lengths; i-=10){

  console.log(temperatures[i]);
}
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

5 Answers

Raymond Osier
Raymond Osier
16,581 Points

yeah i had that problem for a while too .. a month or so ago. the only other suggestions i can give are to keep trying the challenge when you have time. It certainly sounds like a server side issue, iv noticed they will happen from time to time when treeHouse is doing maint, backups or up dates to there system

Ryan Field
PLUS
Ryan Field
Courses Plus Student 21,242 Points

When you loop through an array, even if it's numbers like this one, you don't want to use the values to loop. Your loop is actually starting with the 100th item in the temperatures array, and there are only eight. The challenge wants you to loop through all the items (i.e.: from the first, which is 100, to the last, which is 10), but you still need to do them in order of their position in the array, that is 0 through 7:

var temperatures = [100,90,99,80,70,65,30,10];

for (var i=0; i<temperatures.lengths; i+=1){

  console.log(temperatures[i]);
}

does not work

the failure notice is always:

communication problem!!

i already wrote a few messages to treehouse, but they cannot help

Raymond Osier
Raymond Osier
16,581 Points

it sounds like your having a communications issue with the workspaces server, try restarting your browser and or computer or check to see that you dont have any programs running in the background that might be slowing down your system causing your workspaces to time out then check your network connection , ryan's code is solid creating a for loop ti iterate threw an array index is a best practice for lack of a better term.

i got this communication problem since a week. i already restarted my browser and restartet my computer also a few times.

does not work