This Lesson is for PRO Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay
Hide playlist

    Refactor Array concat() Operations to Use the ES6 Spread Operator

    In this video, we take a quick look at refactoring usages of Array.prototype.concat to make use of the ES6 array spread operator. For example, we can refactor towards simple append and prepend statements such as [...array, value] or [value, ...array] or combine multiple spread operations to achieve insert via [...leftSide, value, ...rightSide].

    Bonus tip: [...someArray] can be used to quickly make a shallow copy of an array to avoid mutation for many common array operations.

    You must be a Member to view code