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!
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
Brian Jones715 Points
Help with array? How is this done?
Declare a String variable named 'bestFrog' and initialize it to the first element of the frogNames array.
Stone Preston42,016 Points
you need to index your frogNames array. you can index arrays like so:
keep in mind array indexes start at 0 so the above code selects the 4th item in the array (the first item is index 0, the second is index 1, the third is index 2, and the fourth is index 3 and so on)
so I could create a string variable and assign it an index of an array like so:
String myString = myArray;
which would create a new string variable called myString and assign it the value of the first element of the array myArray.
so for the challenge you need to create a string variable called bestFrog and set its value as the first element of the array called frogNames (remember that this is really the 0 index since array indexes start at 0)