(x) => {foo: bar}

monolithed monolithed at gmail.com
Tue Jan 6 16:24:02 PST 2015


Can anyone explain what to expect as a result of the following expression?

var fn = () => ({ a, b } = { a: 0, b: 1 });

1.

var fn = function () {
    var a = 0,
          b = 1;

    return { a: a, b: b };
};

or

2. (traceur-compiler)

var fn = function () {
    var tmp;

    return (tmp = {a: 0, b: 1}, a = tmp.a, b = tmp.b, tmp);
};


There're global variables in the second case
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150107/3dc6de3e/attachment.html>


More information about the es-discuss mailing list