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 trialEmanuel Tesfaye
8,572 Pointsjavascript loops,arrays and objects
The script.js file contains an array of string values -- the names of players in a game. Let's practice using array indices to access individual names in the array. Log the first name of the array using the console.log() method. need help what am I doing wrong?
var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick'];
console.log(players[0]);
console.log(players[1]);
console.log(players[2]);
console.log(players[3]);
console.log(players[4]);
console.log(players[5]);
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JavaScript Loops</title>
</head>
<body>
<script src="script.js"></script>
</body>
</html>
2 Answers
jacobproffer
24,604 PointsIn this instance, the first prompt is only asking you to log the first name.
console.log(players[0]); // First name
You'll then be asked to log the last name.
console.log(players[0]); // First name
console.log(players[5]); // Last name
Emanuel Tesfaye
8,572 PointsConsole.log(players[0]); thanks Jacob English is my second language I'm still struggling I think that's why I didn't understand the question
jacobproffer
24,604 PointsNo problem. I've been stumped on plenty of questions.