Does node.js support the 'let' statement?

Solution 1:

Yes, you can use let within node.js, however you have to run node using the optional --harmony flag. Try the following test.js:

"use strict"
var x = 8,
    y = 12;

{ let x = 5, y = 10; console.log(x + y); }

console.log(x + y);

And then run the file node --harmony test.js which results in:

15
20

I would not recommend using this in an important production application, but the functionality is available now.

Solution 2:

This is an old question and the accepted answer is no longer correct.

let support was added in Node.js 4.x.

See here for the full version support matrix.