Node.js is Harmonious
- Block scoping
- ES6 semantics for
- Module declaration
In order to use the ES6 goodies, you need to run
node with some flags. Alex Young from DailyJS describes how to use ES6 in Node.js, and even though the article getting pretty aged, the content seems pretty consistent with the current state of Node.js and V8.
Traceur is a project by Google that compiles ES6 code into ES5 code. It also comes with a small 23KB (minified, not GZipped) file that offers all of the utility code you need to get the compiled code to do all the cool things that ES6 does. While developing, you can include a much larger file instead, which will compile the code in the browser so that you can make quick changes without the need to compile again before refreshing the browser.
To compile your code, you can either use the Traceur compiler (available through NPM with
npm install -g traceur on the command line) directly or you can set up Grunt or Gulp to do it. The Traceur compiler is a lot easier to get started with, so it's good for experimenting to see if you like it, but once you're using Traceur consistently in your projects, you're a lot better off getting a task runner to handle it for you because they can watch your files for changes and automatically compile any time you save an ES6 file.
I'm sorry I didn't go into much detail about using Traceur, but I will be giving a more thorough tutorial on using it soon enough. You should be able to see, though, that ES6 is ready to use now, so don't sit around moping that you'll never really get a chance to use it in a project. God bless and happy coding!