The JavaScript Spread Operator, denoted by three dots (...), allows an iterable (like an array or string) to be expanded or “spread” into places where zero or more arguments or elements are expected.
Think of it as taking a box of items and unpacking them all at once onto a table, rather than taking them out one by one.
Here is a breakdown of how to use it effectively with Arrays, Objects, and Functions.
1. Basic Syntax
- …arr “spreads” the array elements
- Works with arrays, strings, objects, maps, sets, and iterables
