De-structuring array arguments

Jordan Harband ljharb at gmail.com
Thu Jan 17 21:35:50 UTC 2019


I'm not sure what you mean, that should certainly be possible today. In
node, I get this:
```

function foo ([a, b] = [1, 2]) { return [a, b]; }

foo([2, 3]) // [2, 3]

foo() // [1, 2]

```

On Thu, Jan 17, 2019 at 9:50 AM Sultan <thysultan at gmail.com> wrote:

> Consider the following is not possible today:
>
> function foo ([a, b] = [1, 2]) {}
>
> foo([2, 3])
>
> While the the following is outside of function arguments:
>
> const arr = [1, 2]
> const [a, b] = arr
>
> Is there any reason for the current status quo?
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20190117/411e05d9/attachment.html>


More information about the es-discuss mailing list