0 added
0 removed
Original
2026-01-01
Modified
2026-02-21
1
<p>The spread statement in function<strong>calls</strong>is<strong>syntactically</strong>identical to the rest statement in definitions, but does the<strong>opposite</strong>. Let's take the sum() function as an example:</p>
1
<p>The spread statement in function<strong>calls</strong>is<strong>syntactically</strong>identical to the rest statement in definitions, but does the<strong>opposite</strong>. Let's take the sum() function as an example:</p>
2
<p>Let's call sum() by applying the spread statement to an array of arguments:</p>
2
<p>Let's call sum() by applying the spread statement to an array of arguments:</p>
3
<p>The spread statement decomposes the array into arguments. The number of arguments received by the spread statement is equal to the number of array elements. In essence, the code above is converted into a call:</p>
3
<p>The spread statement decomposes the array into arguments. The number of arguments received by the spread statement is equal to the number of array elements. In essence, the code above is converted into a call:</p>
4
<p>As with function definitions, the spread operator can be used in conjunction with positional arguments:</p>
4
<p>As with function definitions, the spread operator can be used in conjunction with positional arguments:</p>
5
<p>Unlike the rest-operator in the definition of functions, the spread-operator does not have to be last, it can be in any position:</p>
5
<p>Unlike the rest-operator in the definition of functions, the spread-operator does not have to be last, it can be in any position:</p>
6
<p>Moreover, there can be any number of spread operators and in any order:</p>
6
<p>Moreover, there can be any number of spread operators and in any order:</p>
7
7