Variadic function: Difference between revisions

Content deleted Content added
Capmango (talk | contribs)
Added Javascript example
Line 63:
// Can be used to print:
// printSpaced(1, 2, "three");
 
== Variadic functions in JavaScript ==
In [[JavaScript]], the arguments to a function may be accessed as local variables within the function.
They also exist as members of a local array within the function, called '''arguments'''.
 
function printSpaced() {
for (var i = 0; i < arguments.length; i++) {
document.write(arguments[i] + " ");
}
}
 
== Variadic functions in Python ==