Download to read offline




![Spread in function calls Example function getEmployeeDetails( id, name, designation ){ return id + “ ” + name + “ “ + designation; } var params = [ “emp01”, “PJ”, “SSE” ]; getEmployeeDetails( …params );](https://image.slidesharecdn.com/spreadsyntax-170904081525/75/8-Spread-Syntax-ES6-JavaScript-5-2048.jpg)
![Spread in array literals Array concatenation using spread literals. Example var arrOne = [ 1, 2, 3 ]; var arrayTwo = [ …arrOne, 4, 5, 6 ]; console.log( arrayTwo );](https://image.slidesharecdn.com/spreadsyntax-170904081525/75/8-Spread-Syntax-ES6-JavaScript-6-2048.jpg)
![Spread in object literals Array concatenation using spread literals. Example var objOne = [ “name” : “PJ” ]; var objTwo = [ “designation” : “SSE” ]; var cloneObj = { …objOne }; var mergeObj = { …objOne, …objTwo }; console.log( cloneObj ); console.log( mergeObj );](https://image.slidesharecdn.com/spreadsyntax-170904081525/75/8-Spread-Syntax-ES6-JavaScript-7-2048.jpg)


The document presents an overview of the spread syntax in ES6, detailing its application in function calls, array literals, and object literals. It describes how spread syntax allows for the expansion of arrays and objects into individual elements or key-value pairs. Examples illustrate the use of spread in various scenarios, including passing parameters to functions and merging objects.