Variadic function: Difference between revisions

Content deleted Content added
In JavaScript - Change the second example to be more in line with the first
In JavaScript - wording and indentation
Line 210:
</syntaxhighlight>
 
It's also possible to create a variadic function using the arguments object, thoughalthough it is only usable with functions created with the {{code|function}} keyword.
 
<syntaxhighlight lang="javascript">
function sum() {
return Array.prototype.reduce.call(arguments, (a, b) => a + b, 0);
}