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

Possible bug in array Javascript challenge

Hello,

I was doing some array challenge in Javascript that can be found here https://teamtreehouse.com/library/javascript-loops-arrays-and-objects/tracking-multiple-items-with-arrays/using-array-indices

It appears that I can do the first step of the challenge but it doesn't let me get through the second one

var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick'];

console.log(players[0]);

However, when asked to get the last item ( which is Index number 5 ) by simply changing the index number from 0 to 5 in my code, but I get an error. I tried all index numbers in case they didn't make the test right but it still doesn't work.

I tried to report the bug but I got an automated response so I need to put it here.

1 Answer

They're not asking you to replace the first one, you need to console.log(players[5]); underneath the first request.

Thanks! The test makers didn't specify you had to insert it under the previous task's code which is confusing ---- >"Now, use console.log() to log out the last item in the array."