WeCodeAcademy

Destructuring and Spread

Destructuring unpacks values into variables. Spread (...) copies or merges arrays and objects.

Examplejavascript
Open in editor »
Quick check

What does `[...a, ...b]` do?

Your turn: write the code

Use destructuring to pull name and age out of user, then print them with console.log(name, age).

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.