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 trialFareedah James
Courses Plus Student 6,199 PointsTrouble getting elements in an array
Having trouble with the arrays section when getting an array set in the code challenge var myArray = ["sugar", "rush", "fix", "it", 3.14, 42]; var thirdElementInArray = myArray[3];
my answer: var myArray = [3]; var newthirdElementInArray = myArray[3]; the code challenges tells me : remeber array indexes start with zero
Not sure what I have done wrong. Please help!
2 Answers
Jason Anello
Courses Plus Student 94,610 PointsHi Fareedah,
Array indices start at zero but element numbering starts at 1. This means the 1st element in the array is at index 0.
The 3rd element in the array would be at index _____?
It wants the variable thirdElementInArray
to be assigned the 3rd element in the array. So you have to fix that index number.
Fareedah James
Courses Plus Student 6,199 PointsI just figured it out! Thanks so much for your help!