This lesson is for PRO members.

Unlock this lesson NOW!
Already subscribed? sign in

Create a Shallow Copy of an Array with Slice

9:15 JavaScript lesson by

Array slice creates a shallow copy of an array. In this lesson we cover, in detail, exactly what a 'shallow' copy is and how it can trip people up. We go on to look at examples that show to how to copy only the first item, the last item and even how to copy a sub-section of an array excluding the first and last. We end the lesson with a practical example that shows how slice fits into a workflow that contains other array methods such as map & reduce.

Get the Code Now
click to level up

egghead.io comment guidelines

Avatar
egghead.io

Array slice creates a shallow copy of an array. In this lesson we cover, in detail, exactly what a 'shallow' copy is and how it can trip people up. We go on to look at examples that show to how to copy only the first item, the last item and even how to copy a sub-section of an array excluding the first and last. We end the lesson with a practical example that shows how slice fits into a workflow that contains other array methods such as map & reduce.

Avatar
Joshua

pretty cool. like this.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?