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 trial

iOS

code challenge: Mutable vs. Immutable 3 of 4

I can not figure out what I am missing:

NSMutableArray *elements = [NSMutableArray arrayWithCapacity : 0];
elements = [NSMutableArray arrayWithObjects:@"Helium", @"Neon", @"Argon", nil];
elements = [title removeObjectAtIndex: 1];

4 Answers

John Hill
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
John Hill
Front End Web Development Techdegree Graduate 35,236 Points

Watch the video, you must. The answers you seek lie deep within you (@~3:15 in the video).

NSMutableArray *elements = [NSMutableArray array];
elements = [NSMutableArray arrayWithObjects:@"Helium", @"Neon", @"Argon", nil];
[elements removeObjectAtIndex: 1];
[elements removeLastObject];
Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Brian your array is called elements so why in your last line are you calling the method removeObjectAtIndex on something called title? It should be called on elements.

Got it thanks.

i don't get it, please can you kindly advise the 3rd & 4th challenge answers so that i can complete the test

hello?