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

hey there can someone help me with this? its saying not logged in order but when i check in my console it works

thanks for any help

script.js
var temperatures = [100,90,99,80,70,65,30,10];
function printList( list ){
    var listHTML = '<ol>';
    for (var i = 0; i < list.length; i += 1){
      listHTML +='<li>' + list[i] + '</li>';
    }
listHTML += '</ol>';
print(listHTML);  
}
console.log(temperatures);
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

are you trying to pass the challenge or is this for yourself?

The reason I ask, is because the code challenges are very tight about what they will accept and not.

its the challenge im trying to pass

2 Answers

Its cool, first remove the function from the challenge. All it wants is either a for loop or a while loop that iterates through the variable temperatures, and then logs the iteration in the console inside the loop. No need to create a list item. It just wants you to log he info in the console.

Let me know if you need more info.

thank you got it working

Awesome!

glad I could help.