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 Loops, Arrays and Objects Tracking Multiple Items with Arrays Using Array Indices

Robert Johnson
Robert Johnson
974 Points

thought maybe it wanted me to use the "pop" method. But its just bugged. console.log(players[5]) is the answer.

Challenge is just straight bugged.

script.js
var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick'];
console.log(players[5]);
index.html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>

2 Answers

Steven Parker
Steven Parker
231,275 Points

Actually, using "pop" would not seem appropriate to the instructions. They say "Let's practice using array indices to access individual names in the array.". Also, they don't say anything about changing the contents of the array, which would happen if you use "pop" on it.

And like all multi-task challenges, each task builds on the last one. So when you move from task 1 to task 2, the code that passed task 1 should remain as it is while you add a new line to satisfy task 2.

Hi Robert. It looks like you already know the answer. If it is failing, it's likely because you removed the line of code for part 1, as Steven said.