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

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