Rest parameter syntax

T.J. Crowder tj at
Tue Jun 12 08:51:59 PDT 2012

On 12 June 2012 16:42, Herby Vojčík <herby at> wrote:

>> But I understand there are problems. First, what with optional params
> after And the second, how to parse it when foo(1, 2) called?
I would think with

function foo(a, b, ...others, c) {

then given

foo(1, 2);

...within foo a is 1, b is 2, others is empty, and c is undefined. E.g.,
args prior to the restargs get priority over args after rest args. This is
consistent with


...where within foo a is 1, b is undefined, others is empty, and c is

It does seem as though it can be deterministic, and pretty easy to explain.
Which isn't necessarily an endorsement, just identifying that this
particular issue doesn't immediately seem like a roadblock.

-- T.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list