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


A Fool from the UK scratching his head, Arrays; how hard can they be !!!!!

Now, use console.log() to log out the last item in the array. Oops! It looks like Task 1 is no longer passing. Get Help Recheck work Go to task One script.js index.html

1 var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick']; 2 console.log ( players [5] );

6 Answers

Hi Martin,

Can you tell me which code challenge that is?

Hi, I am and have been trying for some days the second part of challenge 1 of 2; the first part works fine though it all goes wobbly on the second (Code Challenge: using Arrays). - var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick']; console.log ( players [5] );

I just went to that challenge: "Using Array Indices" in the JavaScript Loops, Arrays and Objects.

So task one is log the first item in the array, and the second is log the last.

Did you keep both log statements, or did you just have the second one in there?

Because you need to have both of them for both tasks to pass.

Your log statement is correct for task 2, the first task is the same except you put in index "0" instead of index "5".

As you may see, the second challenge I just changed the [0] from the first to [5] for the second; not good ??. May I say, I have just tried using both at the same time, and I feel and Class Plank, thank you very much for putting me right Sir.

Cant even type correctly, A Class Plank is what I actually mneant

No worries. :D