Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript JavaScript Loops, Arrays and Objects Tracking Multiple Items with Arrays Iterating through an Array

How do I log the numbers from 100 to 10.

I thought changing the < and > sign that it would work but it is not. Can anyone explain what is going wrong.

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

1 Answer

Steven Parker
Steven Parker
221,902 Points

There's nothing named "print" defined in this code, and you won't need any HTML tags. You also don't need to create a function.

Just use "console.log" inside the loop to directly log each item from the "temperatures" array.

And check the limit test being used in the conditional clause of the "for" loop.

I did what you told me and i still seem to be getting the answer incorrect how do I upload my new answer to show you

Steven Parker
Steven Parker
221,902 Points

You can paste in your code, just use "markdown" formatting. There's a pop-up "cheatsheet" below, or you can watch this video on code formatting.