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 Review Array Methods, Iterating and Two-Dimensional Arrays

The following code should print out each item in the array times, but there's one part missing. Finish the code to log o

help please not sure what to put here var times = [ 1.22, 1.75, 2.10, 2.55 ]; for (var i=0; i < times.length; i += 1 ) { console.log(times[]); }

1 Answer

Jamie Reardon
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Jamie Reardon
Treehouse Project Reviewer

You are very close! You need to enter the variable i inside of the brackets of the console.log output. You are looking to access the items in the array, and you would do so using bracket notation. Since you want to output all the items it is based to use a loop for this. Therefore it is fortunately convientant to use the index/counter variable to do this!