+ 6
spread operator spreads the array type object into individual elements while rest collect those individual elements and packs them into an array
+ 2
Porkalai Selvi
What Abhay said is true. Both look alike(...), Rest is used to collect all those excess arguments you might pass into a function to an array and Spread syntax is used to spread an array and provide it's elements as arguments to a function.
Ex:
------------
// Rest parameters
function restParams( var1, var2, ...restVars){
// Do something here.
}
restParams(1,2,3,4,5,6);
// Now, restVars inside the function is [3,4,5,6]
// Spread syntax
let varArr = [7,8];
// providing varArr to restParams
restParams(varArr); // Wrong
restParams (...varArr); // Right
--------------
See this page: https://javascript.info/rest-parameters-spread



