Rick Waldron (2015-03-25T15:56:28.000Z)
On Wed, Mar 25, 2015 at 2:40 AM Robin Cafolla <robin at zombiemongoose.com>
wrote:

> Hi there,
>
> I was wondering if there were any plans to modify `arguments` to include
> default parameters (e.g. changing it from a simpleParameterList) or to
> include a new property that does allow iteration of all values available to
> a function.
>
> for example:
>
>     function foo( a, b = 2 ) {
>         return arguments;
>     }
>
>     console.log( foo( 1 ) ); // outputs [ 1 ], not [ 1, 2 ]
>
> Currently I can't see a way of getting default parameters as an iterable
> object.
>
> I filed a bug with Mozilla over this, but they pointed out that the
> behaviour matches the spec.
>
> https://bugzilla.mozilla.org/show_bug.cgi?id=1144672
>


This is correct, because only one _argument_ was passed, therefore the
arguments object has only one entry. Parameters are not the same as
Arguments.

Therefore:

  foo(1, 3) => [1, 3]

Because two arguments were passed. And:

  foo(1, 2, 3) => [1, 2, 3]

Because three were passed.

Hopefully that helps clarify?

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150325/15cd5bb7/attachment-0001.html>
d at domenic.me (2015-04-14T22:05:34.384Z)
This is correct, because only one _argument_ was passed, therefore the
arguments object has only one entry. Parameters are not the same as
Arguments.

Therefore:

    foo(1, 3) => [1, 3]

Because two arguments were passed. And:

    foo(1, 2, 3) => [1, 2, 3]

Because three were passed.

Hopefully that helps clarify?