Generator issue: exceptions while initializing arguments

Brendan Eich brendan at mozilla.com
Mon Sep 10 15:12:02 PDT 2012


Oops, missing one line below:

Brendan Eich wrote:
> Which one? If you mean let*, so that
>
>   function f(a = a, b = b*a) { return [a, b]; }
>   var a = 42;

var b;

>   console.log(f()) // [42, NaN]
>   console.log(f(1)) // [1, NaN]
>   console.log(f(1,2)) // [1, 2]

Otherwise b*a will throw on unbound b.

/be


More information about the es-discuss mailing list