On Apr 9, 2011, at 10:08 PM, Sean Eagan wrote:
> function ({a, b}){}
> //or
> function ({a: b, c: d}){}
This has been implemented since at least Firefox 3 (also IINM supported in
Rhino):
js> function f({a, b}){print(arguments[0], arguments.length, a, b)}
js> f({a:42, b:99})
[object Object] 1 42 99
js> function g({a:x, b:y}){print(arguments[0], arguments.length, x, y)}
js> g({a:43, b:100})
[object Object] 1 43 100
It is part of the Harmonious Proposal.
The actual (positional) parameters reflect as arguments properties, while the
formal (destructured-to) variables are local bindings equivalent to var
declarations, initialized before the body of the function is evaluated.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss