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

Ruby Ruby Collections Ruby Arrays Removing Items From Arrays

.slice method is not removing elements from the original array

in the video the .slice method was mentioned correctly, that it return elements from the original array without deleting them from the main array, in the contrary, the .slice method was mentioned in the notes under the video, that it will also "remove" the elements from the main array, would you please correct it in the notes :)

thanks,

2 Answers

The error is on the teachers behalf, please ignore the last note.

The slice method takes two arguments and removes and returns items from the array. The first argument is the index in the array, and the second argument is the number of items:

Misty McCray
Misty McCray
7,225 Points

I am also seeing that slice returns but does not remove. I was also confused by the notes stating otherwise.