Join egghead, unlock knowledge.

Want more egghead?

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock This Lesson
1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Merge Arrays using the Spread Operator

    Laurie BarthLaurie Barth
    javascriptJavaScript

    Use the spread operator to merge multiple arrays. This example uses two, but the same pattern can be used.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    Instructor: Define an array that we'll call R1.

    Next, define a second array that we'll call R2.

    Finally, you can use the spread operator for R1 and R2, and it will merge the two arrays into a single array.

    Discuss

    Discuss