Spread Operator (…) in JavaScript
1 min readMay 24, 2020
… called as spread operator
Usage:
concatenate two or more arrays
const newList = […firstList, …secondList, …etcLists]
concatenate two or more objects
const newObject = {…firstObject, …secondObject, …etcObjects}
… in function arguments
const list = [1,3]
function sum(a,b){
return a+b;
}sum(…list)
This is how … (spread operator) used.