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
phillipfreeman2
5,804 PointsTracking Multiple Items with Array: Code Challege
Hello I have been having trouble with my code in the following challenge:
var temperatures = [100,90,99,80,70,65,30,10];
for ( var i = 0; i < temperatures.legnth; i += 1 ) {
console.log(temperatures[i]);
}
I had to use a for or while loop to iterate through the values in the array from the first item to the last item. When I typed out my loop I got an error message saying "TypeError : 'undefined' is not an object (evaluating 'console.log._args[i]'). I am completely stumped.
2 Answers
phillipfreeman2
5,804 PointsThank you so much. I have solved it just a minute ago by changing the 7 to an 8 to log all of the numbers in the console.
Hugo Paz
15,622 PointsHi Phillip,
You have a typo in your for loop. temperatures.legnth should be temperatures.length