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 trialMartin Brown
Courses Plus Student 10,510 PointsA 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
dmzstudio45
43,976 PointsHi Martin,
Can you tell me which code challenge that is?
Martin Brown
Courses Plus Student 10,510 PointsHi, 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] );
dmzstudio45
43,976 PointsI 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".
Martin Brown
Courses Plus Student 10,510 PointsAs 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.
Martin Brown
Courses Plus Student 10,510 PointsCant even type correctly, A Class Plank is what I actually mneant
dmzstudio45
43,976 PointsNo worries. :D