JavaScript Spread Operator| Object Spread Operator Tutorial By WDH

JavaScript Spread Operator


JavaScript Spread Operators
Spread is an array/object expiration to be expanded in places where zero more key value pairs are expected. Spread allows iterators over the arguments. 
Spread in Function calls 
  • Spread is working as a replacement for the apply function.
  • Spread is used to pass an array of arguments to a function.
The Syntax Spread function is as follows:
Functioncall(…iterableObject);
Spread in array literals
Array concatenation using spread literals.
The Syntax of Spread in array concatenation using spread literals is as follows:
var arrObj1 = [1,2,3,4,5];
var arrObj2 = [6,7,8,9,10];
var combined = […arrObj1, … arrObj2 ]
console.log(combined) 
Example
Output
Spread Operators
Apple,Grapes,Banana