It expands an iterable object into the list of arguments. (Arrays, Objects, Strings )
When …arr is used in the function call, it ‘expands’ an iterable object arr into the list of arguments.
const arr = [34, 22, 13, 3]
Making a copy of an array object.
const arr = [34,22,13,3]
Concatenating Arrays & Combining objects
// combining arrays
// combining objects
Passing the array into the Math.max() function doesn’t work but using the spread operator spreads the array into individual elements of the array.
const arr = [1,2,3,4]
Even though both of them have the same syntax”…”.
Both of them are the exact opposite of each other.
The Rest Parameter casts a list of items into an array and the spread operator expands an iterable object into its individual elements.