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 trialJacques Potgieter
6,454 PointsLast Step of Challenge for Arrays
I cannot seem to get the challenge completed. Go through the first 3 challenges but on the last one to change the double to a var or object field, i get the same issue.
on the console i tried object [] as the array and also get/set but still did not get the results wanted.
double[] lapTimes = new var[4];
lapTimes[0] = 2.2;
double[] finalLapTimes = {2.2, 2.3, 2.5, 2.8};
object[] finalLapTimes = {2.2, 2.3, "lap3", 2.8};
5 Answers
markmneimneh
14,132 PointsHello
I think you are misreading the question. It a bit confusing ...
var lap3 = finalLapTimes[2];
is all what is being asked
If this answers your question, please mark question as answered.
Jacques Potgieter
6,454 PointsHi Mark, I thought the same thing but tried it in the console, worked...but still wont accept it. As I said, I have tried to add in SetValue but still not working...
Perhaps I'm missing something
double[] lapTimes = new var[4]; lapTimes[0] = 2.2; double[] finalLapTimes = new double[4]{2.2, 2.3, 2.5, 2.8}; var lap3 = finalLapTimes[2];
markmneimneh
14,132 PointsThis is the problem double[] lapTimes = new var[4]
it needs to be double[] lapTimes = new double[4]
somehow you passed the first challenge, but it trips you in last one
markmneimneh
14,132 Pointsthis should be all 4 answers ... you were in the right direction all along, it just the messages from the challenge can be misleading
double[] lapTimes = new double[4]; lapTimes[0] = 2.2; double[] finalLapTimes = {2.2, 2.3, 2.5, 2.8}; var lap3 = finalLapTimes[2];
Jacques Potgieter
6,454 PointsOh wow!! Hahaha.....I must have missed it in trying something else....OMW..
Awesome! Thank you It worked!