Using destructuring for function arguments

Jason Orendorff jason.orendorff at
Sat May 31 13:56:52 PDT 2014

On Sat, May 31, 2014 at 1:59 PM, Nicholas C. Zakas
<standards at> wrote:
> 1. Who is right about assigning a default value to a destructured parameter,
> Firefox or Traceur?

Traceur is right.

> 2. Is the behavior of not having any bindings for destructured parameter
> properties correct? And if so, is it desirable?

I think you're mistaken about this. What happens is that

    function setCookie(name, value, { secure, path, domain, expires }) {
        // ...

behaves like

    function setCookie(name, value, options) {
        var { secure, path, domain, expires } = options;
        // ...

and the error is in trying to unpack options, which is undefined, not
in later trying to use the variables.


More information about the es-discuss mailing list