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 trialNigel Matheson
Courses Plus Student 1,166 PointsMy code is not working?
this is not working and it is driving me crazy
// Enter your code below
var arrayOfInts = [1,2,3,4,5,6]
arrayOfInts.append (7)
arrayOfInts = [1,2,3,4,5,6,7] + [8]
arrayOfInts.remove (at:4)
Let value = arrayOfInts [4]
2 Answers
Steve Hunter
57,712 PointsHi Nigel,
You got most of that spot on.
For the second task, I don't think it was expecting you to recreate the initial array. The concatentate could look something like:
arrayOfInts = arrayOfInts + [8]
The third task wants you to retrieve the value at index 4 and store it in a constant called value
. You've removed the value then tried to store the [4]
in value
- but you've also used a capital L
on let
- so, don't remove the element (delete that line) then correct the capitalisation:
let value = arrayOfInts[4]
The last task wants you to remove an element - I'll leave that task with you.
Steve.
Nigel Matheson
Courses Plus Student 1,166 Pointsthank you steve
Steve Hunter
57,712 PointsNo problem!