Reputation: 35790
When I run the following snippet in Chrome, it runs perfectly:
(({foo}={}) => {console.log(foo);})({foo: 'baz'});
// logs "baz"
However, if I run that same snippet in Node I get a:
ReferenceError: Invalid left-hand side in assignment
... despite the fact that I ran Node with both the default and destructuring harmony parameters:
nodejs --harmony --harmony_destructuring --harmony_default_parameters
So, my question is, what magic incantation does Node require to process this (perfectly valid, as far as I can tell) ES6 statement?
Upvotes: 0
Views: 74
Reputation: 35790
As @dvlsg suggested, this is simply a bug in the experimental implementation of these Node features.
However, as @estus suggested, and as indicated by the Node developers themselves here, the soon-to-be-released new version of Node will not only fix this problem, it will also roll the bulk of the ES6 functionality directly in to Node (ie. no more node --harmony_whatever
).
Upvotes: 0