1/* Spread syntax ( ex. ...arrayName) allows an iterable such as an array expression or string
2to be expanded in places where zero or more arguments (for function calls)
3elements (for array literals) are expected, or an object expression to be
4expanded in places where zero or more key-value pairs (for object literals)
5are expected. */
6
7
8//example
9function sum(x, y, z) {
10 return x + y + z;
11}
12
13const numbers = [1, 2, 3];
14
15console.log(sum(...numbers));
16// expected output: 6
1//Example:
2const numbers1 = [1, 2, 3, 4, 5];
3const numbers2 = [ ...numbers1, 1, 2, 6,7,8];
4// this will be [1, 2, 3, 4, 5, 1, 2, 6, 7, 8]