Allen Wirfs-Brock (2013-06-27T16:07:04.000Z)
On Jun 27, 2013, at 3:19 AM, Marius Gundersen wrote:

> I'm testing some code in the latest version of Firefox, and it seems I'm not able to define default values to function arguments which are destructured. For example:
> 
> function test([a, b] = [1, 2]){
> 
> 
>     return a+b;
> }
> 
> 
> test([3, 4])//expect 7
> test([3])//expect NaN
> test()//expect 3
> 
> //Exception: missing ) after formal parameters (line 1)
> 
> I haven't found this defined in the current grammar,

see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-13 
 FormalParameter :
      BindingElement

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.4 
  BindingElement :
      BindingPattern Initialiser<opt>

  BindingPattern :
     ArrayBindingPattern
   

> but would be useful for something I'm currently working on. Or maybe it just isn't implemented in Firefox?

> 
> Marius Gundersen
> 
> 
> _______________________________________________
> 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/20130627/2985b63c/attachment.html>
github at esdiscuss.org (2013-07-12T02:27:37.424Z)
On Jun 27, 2013, at 3:19 AM, Marius Gundersen wrote:

> I haven't found this defined in the current grammar,

see http://people.mozilla.org/~jorendorff/es6-draft.html#sec-13 

```
FormalParameter :
    BindingElement
```

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-12.2.4 

```
BindingElement :
    BindingPattern Initialiser<opt>

    BindingPattern :
        ArrayBindingPattern
```