Oliver Hunt wrote:
function foo(x, y = a, z = y) {...}
>
> foo() // x=undefined, y=a, z=a
> foo(1) // x=1, y=a, z=a
> foo(1, 2) // x=1, y=a, z=2???
Why the ???
This makes sense, and it is what other languages with default values do
What other languages?
Say a = 4 outside. Then
foo(1, 2)
should bind x = 1, y = 2, and z = undefined -- it should not skip y just
because y has a parameter default value and bind 2 to z.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss