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 Arrays Store Multiple Values in an Array Access Array Elements by Index

Alejandro Jiménez-Flores
seal-mask
.a{fill-rule:evenodd;}techdegree
Alejandro Jiménez-Flores
Full Stack JavaScript Techdegree Student 14,981 Points

Challenge Task 2 does not accept the correct answer

console.log(players[5]); gives an incorrect answer.

script.js
const players = ['Toni', 'Anwar', 'Mali', 'Carlos', 'Cormac', 'Sariah'];

console.log(players[5]);

1 Answer

Brandon White
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brandon White
Full Stack JavaScript Techdegree Graduate 35,771 Points

Hi Alejandro,

If the code you’ve posted is the way you posted it in the challenge, then the issue you’re running into is that the code for the first challenge is missing.

The idea for these challenges is to add on to the previous challenge. In this case, the second challenge asks that you print the last element in the array on the next line, but instead you’ve replaced the code for the first challenge. So instead of printing the first element and last element in the array, you’re only printing out the last.