Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.