On Tue, Feb 26, 2013 at 5:48 PM, John J Barton
<
johnj...@johnjbarton.com> wrote:
> But the ES documentation has lots of other LHS stuff ( in the ES6 draft,
> LeftHandSideExpression includes NewExpression and CallExpression)
> so perhaps I am completely wrong.
I think it's technically also valid to assign to a call in ES5
(foo()=5 see
http://esparser.qfox.nl/#runnow:on,code:foo%28%29%3D5 ),
though I've yet to see that used in the wild.
ES6 will introduce various ways of destructuring.
Arrays:
var [a,b] = [1,2];
And I believe object destructuring as well, though I've not kept up
much. Would look something like this:
var {a,b} = {a:1, b:2};
I'm sure somebody will chime in with more details :)
Personally, I'm not sure whether I'm happy with these changes. On the
one hand it's interesting and obviously useful. On the other hand I
worry that it'll lead to code that's hard to read and rather
inefficient (in terms of object garbage collection), though engines
will surely optimize for the obvious cases. It's the legibility I
worry about most. Anyhoo...
- peter