Spread and Rest
The ... operator serves two purposes: spreading elements out, and collecting them together.
Spread with Arrays
Loading JavaScript Playground...
Spread with Objects
Loading JavaScript Playground...
Rest Parameters
Collect remaining arguments into an array:
Loading JavaScript Playground...
Rest in Destructuring
Loading JavaScript Playground...
Practical Examples
Loading JavaScript Playground...
Exercise: Merge Arrays
Combine two arrays using spread:
Loading JavaScript Exercise...
Exercise: Sum All
Create a function that sums any number of arguments:
Loading JavaScript Exercise...
Up next · Lesson 31 of 37
String Basics
1 min read
30 of 37 lessons done

Ask Byte about this lesson
A private chat about this lesson. Byte has read the whole lesson, answers in seconds, and shows the section each answer comes from. Ask follow-ups in any language.
Questions & Answers
Public questions about this lesson. The AI Tutor answers right away in your language, the FreeAcademy team checks answers, and every learner can read them.

