Is it possible? It doesn't seem to work in my REPL, neither with nor without --harmony
.
What I'd really like to do is use for..of loops, but let seems a simpler thing to troubleshoot and is likely the same reason.
Anyone know anything about the status of these?
$ node --version
v0.10.13
It was a bit cryptic, you'd think just --harmony
would work, but you need to add in a use strict
somewhere (which you can do at the command line):
$ node --harmony --use-strict
> var letTest = function () {
... let x = 31;
... if (true) {
..... let x = 71; // different variable
..... console.log(x); // 71
..... }
... console.log(x); // 31
... }
undefined
> letTest()
71
31
undefined
>
Much happy!
However, I tried a simple of
comprehension and it didn't work:
[ square(x) for (x of [1,2,3,4,5]) ]
With no luck. It looks like you may have to go past the current stable release to get all the harmony features.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With